Commit Graph

527 Commits

Author SHA1 Message Date
Juan Manuel Macias 893c5d0851
ox-latex.el: Fixes and improvements in `org-latex-language-alist'.
* (org-latex-language-alist): Fix a language code (`de-de') removed
when `org-latex-babel-language-alist' and
`org-latex-polyglossia-language-alist' were merged.  New admitted
properties: `:babel-ini-alt', `:script' and `:script-tag'.  Add
language code for ancient Greek.  Fix Afrikaans (was previously
removed).  New languages: Chinese Simplified and Traditional.
Correction of some typos, errors and inaccuracies.  `let' bindings
suggested by Ihor Radchenko.

* (org-latex-guess-babel-language): Some necessary modifications.

Link: https://orgmode.org/list/8734zoxzd0.fsf_-_@posteo.net
2023-09-10 16:32:29 +03:00
Ihor Radchenko f97877a069
ox-latex: Prefer :latex-src-block-backend INFO property over variable
* lisp/ox-beamer.el (org-beamer-template):
* lisp/ox-latex.el (org-latex-template): Reuse INFO plist to retrieve
src backend.  Direct usage can break user settings where INFO channel
is expected to be modified and have effect.
2023-09-01 13:42:27 +03:00
Ihor Radchenko 85c94ecfc2
ox-latex: Improve warning for unexpected org-latex-src-block-backend
* lisp/ox-latex.el (org-latex-inline-src-block):
(org-latex-src-block): Update the warning text, explicitly mentioning
the variable name to be adjusted.

Reported-by: Guillaume MULLER <guillaume.muller@emse.fr>
Link: https://orgmode.org/list/b5c056cb-3258-4a11-2d9b-33c97b112d62@emse.fr
2023-08-24 10:37:52 +03:00
Juan Manuel Macias 2eb4fd8900
lisp/ox-latex.el: Add the `:literal' attribute to verse block.
* (org-latex-verse-block): Now the treatment of blank lines is
consistent with the syntax of the LaTeX `verse' environment, and the
one provided by the `verse' package.  If the `:literal' attribute is
used, all blank lines are preserved and exported as
`\vspace*{\baselineskip}', including the blank lines before or after
contents.  The rx code has been suggested by Ihor Radchenko, to
improve readability.

* doc/org-manual.org (Verse blocks in LaTeX export): The new feature
is documented.

* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Updated.
2023-08-18 11:41:24 +03:00
Ihor Radchenko 3b49db8755
Revert "Prefer `string-search' when matching exact strings"
This reverts commit e9110a8dd7.

`string-search' is not available in Emacs<28 and also always
case-sensitive.
2023-08-18 11:00:13 +03:00
Ihor Radchenko 1c00632f11
org-latex-compile--postprocess: Fix when OUTFILE has no directory
* lisp/ox-latex.el: Make sure that we do not pass nil to
`directory-files'.  Use `default-directory' when OUTFILE is like
"file.foo" without any directory component.
2023-08-15 13:13:44 +03:00
Ihor Radchenko f93d855c51
Prefer `forward-line' over `beginning-of-line'
The latter is much slower.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01 14:36:14 +03:00
Ihor Radchenko 81a7e8c836
org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument
to be a symbol.
* lisp/ox-ascii.el (org-ascii--current-text-width):
(org-ascii-format-inlinetask-default):
(org-ascii-section):
* lisp/ox-beamer.el (org-beamer--format-block):
* lisp/ox-html.el (org-html-section):
(org-html-table-cell):
(org-html-table-row):
* lisp/ox-latex.el (org-latex-table-cell):
(org-latex-table-row):
* lisp/ox-odt.el (org-odt-headline):
(org-odt-table-style-spec):
(org-odt-get-table-cell-styles):
(org-odt-table-cell):
(org-odt-table-row):
* lisp/ox-org.el (org-org-section):
* lisp/ox-publish.el (org-publish-collect-index):
* lisp/ox-texinfo.el (org-texinfo--get-node):
(org-texinfo-section):
(org-texinfo-table-row):
* lisp/ox.el (org-export--skip-p):
(org-export-get-node-property):
(org-export-table-cell-borders):
(org-export-table-row-in-header-p):
(org-export-table-row-number):
(org-export-collect-headlines): Update all the callers.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 2d22d7f515
ox.el: Rename `org-element-get-parent-element' and move to org-element
* lisp/org-element.el: Rename `org-element-get-parent-element' to
`org-element-parent-element'.
* lisp/org-compat.el (org-export-get-parent-element):
* lisp/ox.el (org-export-get-parent-element): Remove, adding obsolete
alias.
(org-export--skip-p):
* lisp/org-table.el:
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-footnote-reference):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-format-label):
(org-odt-link--inline-image):
(org-odt-link--inline-formula):
* lisp/ox-texinfo.el (org-texinfo--inline-image): Update all the
callers.
2023-07-01 14:35:42 +03:00
Ihor Radchenko ea4f4fdf58
Rename `org-export-get-parent' to `org-element-parent' 2023-07-01 14:35:41 +03:00
Ihor Radchenko a7d1dfa171
Use `org-element-type-p'
Use `org-element-type-p' across Org source, except some tests, where `eq' can
produce more meaningful failure explanations.
2023-07-01 14:35:35 +03:00
Ihor Radchenko c22697f472
Use new function names `org-element-extract' and `org-element-set' 2023-07-01 14:35:32 +03:00
Matthew Trzcinski 88c572de25 Create aliases for export region functions
lisp/ox-ascii.el: Create alias `org-export-region-to-ascii` for
`org-ascii-convert-region-to-ascii`.
lisp/ox-html.el: Create alias `org-export-region-to-html` for
`org-html-convert-region-to-html`.
lisp/ox-latex.el: Create alias `org-export-region-to-latex` for
`org-latex-convert-region-to-latex`.
lisp/ox-md.el: Create alias `org-export-region-to-md` for
`org-md-convert-region-to-md`.
lisp/ox-texinfo.el: Create alias `org-export-region-to-texinfo` for
`org-texinfo-convert-region-to-texinfo`.
doc/org-manual.org: Change commands from "*-convert-region-*" form to
the "org-export-region-to-*" aliases.  Add function index for aliases.
2023-06-29 21:18:01 +02:00
Ihor Radchenko 989cc51499
Prefer "timestamp" over "time-stamp"
* lisp/org.el (org-time-stamp-formats):
(org-timestamp-formats):
(org-time-stamp-rounding-minutes):
(org-timestamp-rounding-minutes):
(org-time-stamp-custom-formats):
(org-timestamp-custom-formats):
(org-time-stamp):
(org-timestamp):
(org-time-stamp-inactive):
(org-timestamp-inactive):
(org-insert-time-stamp):
(org-insert-timestamp):
(org-toggle-time-stamp-overlays):
(org-toggle-timestamp-overlays):
(org-time-stamp-to-now):
(org-timestamp-to-now):
* lisp/ox.el (org-export-time-stamp-file):
(org-export-timestamp-file): Rename using "timestamp" term, keeping
the old name as alias.
* doc/org-manual.org: Update all the uses, adding #+findex and
 #+vindex entries.  Keep the alias names for searchability.

Adjust all the callers.

The following "time-stamp" uses are unchanged:
1. `org-time-stamp-format' where obsolete and _different_ function
   `org-timestamp-format' still exists.
2. :time-stamp-file property in export INFO plist.  Changing this
   would be breaking.
3. ORG-NEWS remains unchanged.
2023-04-30 13:48:52 +02:00
Ihor Radchenko 42e95938ed
org-latex-compile: Fix erasing PDF output buffer late
* lisp/ox-latex.el (org-latex-compile): Clear the PDF output log
buffer before running compile command.

Fixes regression introduced in 0dfbf0c3.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0_t38_gsmjE-qgPCX07-V0P8FYwYEt9R4AT0dZ_SnXRuA@mail.gmail.com
2023-04-30 10:17:09 +02:00
Ihor Radchenko f81ba451a7
Prefer "backend" over "back-end"
* doc/org-manual.org (Exporting): Add cindex entry for both "backend"
and "back-end" for better searchability.

All other changes are trivial.

Note that `org-element-export-snippet-parser' will still use :back-end
property.  So will ox.el in INFO channel.
2023-04-20 14:11:19 +02:00
Ihor Radchenko 9440a29828
Merge branch 'bugfix' 2023-04-20 11:05:12 +02:00
Ihor Radchenko 27ee55ebfd
ox-latex: Fix << and >> in verbatim and code markup
* lisp/ox-latex.el (org-latex--protect-texttt): Protect "<<" and ">>"
sequences.

Reported-by: Garid Z. <garidzorigoo@gmail.com>
Link: https://orgmode.org/list/871qkhtb4o.fsf@gmail.com
2023-04-20 11:03:17 +02:00
Ihor Radchenko 5d32058bf9
Merge branch 'bugfix' 2023-04-12 10:58:44 +02:00
Ihor Radchenko 5ac1ebaa15
org-latex--protect-texttt: Fix "---"
* lisp/ox-latex.el (org-latex--protect-texttt): Fix >2 consecutive
dashes.

Reported-by: Garid Zorigoo <garidzorigoo@gmail.com>
Link: https://orgmode.org/list/CAEDgBW44j4NpYUpppLpOA5Pmmsfi-GbCzDH4rTmRjf-F64mSaA@mail.gmail.com
2023-04-12 10:57:34 +02:00
Ihor Radchenko c1bb68ab9d
ox: Make export errors more prominent
* lisp/ox-html.el (org-html-fontify-code):
* lisp/ox-latex.el (org-latex-generate-engraved-preamble):
(org-latex-inline-src-block):
(org-latex-src-block):
(org-latex-src--engrave-code):
* lisp/ox-odt.el:
(org-odt--table):
(org-odt--translate-latex-fragments):
(org-odt--export-wrap): Use `warn' instead of `message' when external
dependency/tool is missing/fails.
2023-03-29 16:30:41 +02:00
Ihor Radchenko e9110a8dd7
Prefer `string-search' when matching exact strings
* lisp/ob-core.el (org-babel-inline-result-wrap):
(org-babel-demarcate-block):
* lisp/org-agenda.el (org-agenda-get-represented-categories):
* lisp/org-persist.el (org-persist--read-elisp-file):
* lisp/ox-beamer.el (org-beamer--format-frame):
* lisp/ox-latex.el (org-latex--environment-type):
(org-latex--inline-image): Use a simple and faster `string-search'
when searching for non-regexps.
2023-03-29 15:54:24 +02:00
Ihor Radchenko d2e8a118f6
Merge branch 'bugfix' 2023-03-14 13:21:28 +01:00
Pedro Andres Aranda Gutierrez 3eb51d8dbc
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): Fix typo 2023-03-14 13:20:29 +01:00
Ihor Radchenko 3d04af3826
org-latex-paragraph: Ensure that paragraphs are not split by empty lines
* lisp/ox-latex.el (org-latex-paragraph): If export creates single
paragraph contents with empty lines, remove the empty lines to ensure
that we retain a single paragraph.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tufdb6$11h2$1@ciao.gmane.io
2023-03-14 13:11:37 +01:00
Ihor Radchenko 8589de94d8
Merge branch 'bugfix' 2023-03-07 14:09:48 +01:00
Rudolf Adamkovič eb6379a417
Fix LaTeX spelled as Latex
etc/ORG-NEWS (Non-floating minted listings in LaTeX export):
* lisp/ob-latex.el: (org-babel-execute:latex):
* lisp/org-element.el:
* lisp/ox-ascii.el:
* lisp/ox-html.el:
* lisp/ox-latex.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* testing/examples/ob-maxima-test.org (LaTeX output):
* testing/lisp/test-org-element.el (test-org-element/cache): Spell LaTeX
correctly.
2023-03-07 14:08:40 +01:00
TEC f0dfbf0c39
ox-latex: Erase compile buffer at the start
* lisp/ox-latex.el (org-latex-compile): Before running the compile
command, erase the log buffer to ensure that stale/old logging is
cleared.
2023-01-22 18:18:43 +03:00
TEC b84018633e
ox-latex: Split org-latex-compile into two funs
* lisp/ox-latex.el (org-latex-compile): Split off the postprocessing in
`org-latex-compile' into a new function,
`org-latex-compile--postprocess'.
2023-01-22 18:18:43 +03:00
TEC d0c87c762a
ox-latex: Do not hardcode fallback compiler
* lisp/ox-latex.el (org-latex-compile): Instead of hardcoding "pdflatex"
as the fallback compiler, use `org-latex-compiler'.
2023-01-22 18:18:41 +03:00
Kyle Meyer 96a402780c Merge branch 'bugfix' 2023-01-01 13:15:12 -05:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko a58ab90395
lisp/ox-latex.el: Add export option for `org-latex-listings-src-omit-language'
* lisp/ox-latex.el (latex):
(org-latex-src-block--listings): Use a proper export option, not just
a `defcustom'.
2022-12-18 16:14:14 +03:00
Pedro A. Aranda Gutierrez 322b2fd226
lisp/ox-latex.el: Add `org-latex-listings-src-omit-language'
* lisp/ox-latex.el (org-latex-listings-src-omit-language): New
customization that controls whether language= should be included in
the parameters of the lstlisting environmet generated by a src block.

(org-latex-src-block--listings): Do not add language parameter when
`org-latex-listings-src-omit-language' is non-nil.

* etc/ORG-NEWS (New =org-latex-listings-src-omit-language= variable
for LaTeX export): Document the new defcustom.
2022-12-18 16:10:40 +03:00
Pedro A. Aranda Gutierrez 0c467b6b89
lisp/ox-latex.el: Don't emit empty label=, caption=
* lisp/ox-latex.el (org-latex-src-block--listings): Don't emit label=
when label is empty.  Don't emit caption= and captionpos= when caption
is empty.

This is safe to do as long as we do not set "lstlisting" parameters
globally.  See the discussion in
https://orgmode.org/list/87h6xyqqod.fsf@localhost.
2022-12-18 16:10:39 +03:00
Ihor Radchenko 7f7fb256c6
org-latex-listings-options: Update docstring
* lisp/ox-latex.el (org-latex-listings-options): \lstset is no longer
used.  Clarify that options are now supplied directly to the
environment.
2022-12-12 15:33:52 +03:00
Ihor Radchenko 34a8133715
Revert "lisp/ox-latex.el: put labels inside example blocks"
This reverts commit 304f18cb72.

This patch will break verbatim environment as the label will be
interpreted verbatim as well.
2022-12-08 15:44:58 +03:00
Hugo Heagren 304f18cb72
lisp/ox-latex.el: put labels inside example blocks
* lisp/ox-latex.el (org-latex-example-block): Instead of
`org-latex--wrap-label', manually add label after
\begin{<environment>}.

This produces proper label resolution in LaTeX.  Labels before the
environment begins can be interpreted as referring to the surrounding
section.
2022-12-08 14:35:01 +03:00
Stefan Kangas c8ad9e4b28 Backport commit 8617edfff from Emacs
; Fix typos
8617edfffd07eb80561b4de6a37c5b0b5f442e07
Stefan Kangas
Wed Nov 30 16:59:41 2022 +0100
2022-11-30 17:19:12 -05:00
Juan Manuel Macias fcf63fb31e
lisp/ox-latex.el: fix `org-latex-guess-babel-language'
* (org-latex-guess-babel-language): If the user puts a string other
than AUTO as an argument to `\babelprovide', it gives an error when
exporting. For example:

`#+LaTeX_Header: \babelprovide[onchar=ids,import]{hebrew}'
2022-11-18 16:28:24 +08:00
Kyrylo Simonov 00778ce2a6
Fix missing customization groups
* lisp/ob-tangle.el (org-babel-tangle): Add missing group definition.
(org-babel-post-tangle-hook):
(org-babel-pre-tangle-hook):
(org-babel-tangle-body-hook):
(org-babel-tangle-finished-hook):
(org-babel-tangle-comment-format-beg):
(org-babel-tangle-comment-format-end):
(org-babel-tangle-uncomment-comments):
(org-babel-process-comment-text):
(org-babel-tangle-default-file-mode): Move under `org-babel-tangle'
group.
* lisp/ol-bbdb.el (org-bbdb-anniversaries): Move under `org-agenda'
instead of a non-existent `org-bbdb'.
* lisp/ol-bibtex.el (org-bibtex): Add missing group definition.
* lisp/ol-gnus.el (org-gnus-no-server): Move under group
`org-link-follow' instead of a non-existent `org-gnus'.
* lisp/org-plot.el (org-plot): Add missing group definition.
* lisp/org.el (org-startup): Add missing group definition.
* lisp/ox-latex.el (org-latex-pdf-process): Move under
`org-export-latex' instead of a non-existent `org-export-pdf'.
* lisp/ox-man.el (org-man-pdf-process): Remove reference to
non-existent group `org-export-pdf'.

TINYCHANGE
2022-11-16 09:59:44 +08:00
Ihor Radchenko 5a10517d02
Add missing :package-version tags in changed `defcustom'
* lisp/ob-clojure.el (ob-clojure-babashka-command):
(ob-clojure-nbb-command):
* lisp/ob-exp.el (org-babel-exp-code-template):
* lisp/ob-latex.el (org-babel-latex-pdf-svg-process):
* lisp/org-agenda.el (org-agenda-show-outline-path):
* lisp/org-capture.el (org-capture-templates):
* lisp/org-clock.el (org-clocktable-defaults):
* lisp/org-persist.el (org-persist-directory):
(org-persist-remote-files):
(org-persist-default-expiry):
* lisp/org-refile.el (org-refile-use-outline-path):
* lisp/org-src.el (org-src-lang-modes):
* lisp/org.el (org-resource-download-policy):
(org-safe-remote-resources):
(org-time-stamp-custom-formats):
(org-property-separators):
(org-preview-latex-process-alist):
(org-structure-template-alist):
* lisp/ox-latex.el (org-latex-inline-image-rules):
(org-latex-src-block-backend):
(org-latex-engraved-options):
(org-latex-engraved-theme):
* lisp/ox-md.el (org-md-toplevel-hlevel):
* lisp/ox-texinfo.el (org-texinfo-with-latex): Add :package-version
keywords to the new custom options, and those with the value or
meaning changed.
2022-11-13 15:29:15 +08:00
Ihor Radchenko 6ef33b6dd6
org-latex-src-block--listings: Put options within lstlisting environment
* lisp/ox-latex.el (org-latex-src-block--listings): Do not use global
\lstset to set options.  Prefer optional argument to lstlisting
environment instead.

Reported-by: Denis Bitouzé <denis.bitouze@univ-littoral.fr>
Link: https://orgmode.org/list/87pmepvb7u.fsf@example.com
2022-10-31 16:15:11 +08:00
Ihor Radchenko b93a61af9c
org-latex-line-break-safe: Use safer value of "\\[0pt]"
* lisp/ox-latex.el (org-latex-line-break-safe):
(org-latex-table-row):
Change \empty ending to explicit optional argument.  \empty still has
undesired side effects in some cases.

* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Update tests.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/87o7u9rz1a.fsf@posteo.net
2022-10-29 10:34:05 +08:00
Lucas V. R a7a579d06a
ox-latex: Allow markup objects inside %D spec
* lisp/ox-latex.el (org-latex--format-spec): Pass date through
`org-export-data' just as other backends do.

TINYCHANGE
2022-10-20 12:19:09 +08:00
Ihor Radchenko 5fa66c7ffc
org-latex-verse-block: Fix regression from 3f60acff7
* lisp/ox-latex.el (org-latex-verse-block): Fix logic replacing sole
paragraph breaks according to the new template.
* testing/lisp/test-ox-latex.el: New test file.
(org-test-with-exported-text): New macro for testing export.
(test-ox-latex/verse): New test.
* mk/default.mk (BTEST_RE): Select the new test by default.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/875ygk6a8z.fsf@posteo.net
2022-10-16 11:17:03 +08:00
Max Nikulin 892df429f4
ox-latex: Use \empty instead of \relax after \\
* lisp/ox-latex.el (org-latex-line-break-safe, org-latex-table-row):
* testing/lisp/test-org-table.el (test-org-table/to-latex): Use \empty
instead of \relax to prevent interpreting following "*" and "[" as
optional parts of \\*[LENGTH] command.

Fix regression introduced by 3f60acff77. \\\relax\hline caused
misaligned \noalign error. Org markup:

    | a |
    |---|

\hline is allowed only immediately after \cr while \relax has some side
effects. Hope, \empty just expands to nothing.

Those who used \\ optional argument to adjust amount of space between
lines may add the following tricks:

    First,\\
    @@latex:{\vskip1em}@@second.

    | First                               |
    | @@latex:\noalign{\vskip1em}@@second |

Reported in
gerard.vermeulen, Wed, 12 Oct 2022 03:15:49 +0000.
https://list.orgmode.org/784cf8be450b7d676ddd60214cc847db@posteo.net
2022-10-14 10:27:14 +08:00
Ihor Radchenko 3f60acff77
ox-latex: Protect [...] after \\ to be interpreted as LaTeX argument
* lisp/ox-latex.el (org-latex-linebreak-safe): New constant holding
safe version of LaTeX line break.
(org-latex-table-matrix-macros):
(org-latex-clock):
(org-latex-line-break):
(org-latex-plain-text):
(org-latex-planning):
(org-latex--org-table):
(org-latex--math-table):
(org-latex-table-row):
(org-latex-verse-block): Use the new constant.

* testing/lisp/test-org-table.el (test-org-table/to-latex): Update
tests.

Reported-by: Stewart Thomas <sjt015@bucknell.edu>
Link: https://orgmode.org/list/ce760fc3-5aae-144d-2d02-7dea215f73fc@gmail.com
2022-10-11 11:32:52 +08:00
Kyle Meyer b196a05f5a Clean up spacing to pass Emacs's pre-commit check
Avoid trailing spaces and spaces before tabs.
2022-10-03 17:57:03 -04:00
Bastien a2d1806f66 lisp/ox-latex.el: Fix docstring typos
* lisp/ox-latex.el (org-latex-src-block-backend): Fix typos in docstring.
2022-09-26 06:47:14 +02:00