Commit Graph

555 Commits

Author SHA1 Message Date
Alexander Gogl 46e13c3ebd
ox-latex: New option to customize LaTeX footnote command
* lisp/ox-latex.el (org-export-define-backend): Add option.
(org-latex-default-footnote-command): New custom variable.
(org-latex-footnote-reference): Replace string "\\footnote{%s%s}"
with custom variable.

* etc/ORG-NEWS (New and changed options): Add description to option.

Some LaTeX classes define their own footnote commands. For example,
kaobook (https://github.com/fmarotta/kaobook/blob/master/example_and_documentation.pdf)
has \footnotes and \sidenotes, whereby sidenotes (notes are put into
the outter margin) are the dominant form of putting notes in
kaobook. It would be great if you could make the footnote command in
the footnote function customizable. My proposal is in the attachment.

Modified from a feature request by Alexander Gogl.

Link: https://list.orgmode.org/m2v84fhj9u.fsf@gmail.com/T/#m71809443a3b328ed704712ba53e6bb78282249cc

TINYCHANGE
2024-04-23 13:58:14 +03:00
Ihor Radchenko 093b21c8c3
org-latex--caption/label-string: Add comment 2024-04-10 16:36:10 +03:00
Ihor Radchenko 72b0e9ff04
org-export: Do not strip link type by default during export
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link--inline-image):
* lisp/ox-texinfo.el (org-texinfo-link): Preserve link type during
export for all the links, not just for a hard-coded subset.
* etc/ORG-NEWS (Built-in HTML, LaTeX, Man, Markdown, ODT, and Texinfo
exporters preserve the link protocol during export): Document the
breaking change.

Link: https://list.orgmode.org/orgmode/878r9nofpw.fsf@localhost/
2024-03-12 13:57:47 +03:00
Ihor Radchenko 755fef38f5
Merge branch 'bugfix' 2024-02-28 10:54:50 +03:00
Ihor Radchenko 80dff08ed1
Fix unescaped \ in docstrings
* lisp/org-macs.el (org-split-string):
* lisp/ox-latex.el (org-latex-guess-babel-language): Fix docstrings,
as revealed by compiler warnings.
2024-02-28 10:52:58 +03:00
Ihor Radchenko f90322377c
ox: Fix exporting code blocks with missing language specifier
* lisp/ox-latex.el (org-latex-inline-src-block): Export code blocks
without language as verbatim.
* lisp/ox-man.el (org-man-inline-src-block):
(org-man-src-block): Do not try to call source-highlight executable
when code block language is missing.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-texinfo.el (org-texinfo-src-block): Do not throw error when
code block language is missing.

Reproducer (not available on the list):

  To reproduce my problem you can write create an org-mode buffer (C-x b
  1.org M-x org-mode) with the following content:

  #+begin_src lua :tangle yes  :noweb yes
    aaa
    <<second>>
  #+end_src

  #+name: second
  #+begin_src
   bbb
  #+end_src

  Then enable exporting to texinfo and export the buffer:
    M-: (require 'ox-texinfo)
    C-c C-e i t

  The folllowing backtrace appears (providing you already enabled
  debugging on errors):

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    apply(debug error (wrong-type-argument stringp nil))
    edebug(error (wrong-type-argument stringp nil))
    signal(wrong-type-argument (stringp nil))
    edebug-signal(wrong-type-argument (stringp nil))
    string-match("lisp" nil nil t)
    string-match-p("lisp" nil)
    (edebug-after (edebug-before 1) 5 (string-match-p "lisp" (edebug-after (edebug-before 2) 4
  (org-element-property :language (edebug-after 0 3 src-block)))))

Reported-by: pva-outdoor@yandex.ru
Link: https://list.orgmode.org/orgmode/87jzn7oz1u.fsf@yandex.ru/
2024-02-24 12:52:51 +03:00
Ihor Radchenko 0e1f0e1605
ox-latex: Make errors/warnings during PDF generation more obvious
* lisp/ox-latex.el (org-latex-compile--postprocess): Display a
warning, not message when there are problems with PDF generation.
2024-02-14 15:34:19 +01:00
Juan Manuel Macias 9eec4af620
lisp/ox-latex.el: Add missing character warnings
* (org-latex-known-warnings): Two missing character warnings are
added: one for LuaLaTeX/XelaTeX and another for pdfLaTeX.
2024-02-14 15:29:30 +01:00
Gerard Vermeulen 80e7c9f80f
ox-latex: String variables are not file local safe
* lisp/ox-latex.el (org-latex-default-figure-position):
(org-latex-default-quote-environment, org-latex-image-default-scale):
(org-latex-reference-command): File local safe string variables allow
to write Org files allowing to inject any command.

Link: https://list.orgmode.org/ffa77c01d47b15dfc0ae687cab95fb01@posteo.net/
2024-02-10 15:55:44 +01:00
Ihor Radchenko 0d77cf8421
org-latex-headline: Prevent footnotes in TOC/footers
* lisp/ox-latex.el (org-latex-headline): When headline contains
footnotes and does not have ALT_TITLE, arrange alternative title that
will appear in TOC and footers to not have any footnotes.

Reported-by: Eric Anderson <kluwak@gmail.com>
Link: https://orgmode.org/list/691643eb-49d0-45c3-ab7f-a1edbd093bef@gmail.com
2024-02-09 17:38:43 +01:00
Ihor Radchenko f4414f5dbb
ox-latex: Fix references to src block results without #+name
* lisp/ox-latex.el (org-latex--label): Consider :results property in
addition to :name property of the datum.  For datums that are results
of evaluation, the label may not only come from #+name keyword, but
can also be duplicated from the generating src block.
(org-latex--wrap-label): Do not limit label to elements with #+name.
Rely on `org-latex--label' to return appropriate label (or nil).

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/6d9db4be5d42236391d5c4e530250ee1@posteo.net
2024-02-05 13:29:05 +01:00
Gerard Vermeulen 71fa0014db
lisp/ox-latex.el: make org-latex-prefer-user-labels safe file local
* lisp/ox-latex.el (org-latex-prefer-user-labels): make it a safe file
local variable for consistency with `org-latex-reference-command' and
`org-html-prefer-user-labels' being also safe file local variables.
2024-02-02 14:50:33 +01:00
Ihor Radchenko 402643f194
Merge branch 'bugfix' 2024-02-01 12:45:32 +01:00
Gerard Vermeulen 84f56c47f2
lisp/ox-latex.el: improve org-latex-toc-command docstring
* lisp/ox-latex.el (org-latex-toc-command): specify clearer which
option settings use `org-latex-toc-command'.  This shows also how
to specify a table of contents depth.
2024-02-01 12:44:41 +01:00
Ihor Radchenko 03b383df8b
ox-latex: Remove org-latex-line-break-safe
This reverts commit 3f60acff77 and
subsequent relevant comments.

* lisp/ox-latex.el (org-latex-line-break-safe): Remove constant.  The
\\[0pt] is actually not safe to use in some scenarios. We use a
different approach to avoid plain text [...] being interpreted as
LaTeX optional argument - we escape [ like {[}; that's what pandoc
does.
(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):
* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse):
(test-ox-latex/longtable): Remove references to
`org-latex-line-break-safe'.
* etc/ORG-NEWS (=ox-latex=: ~org-latex-line-break-safe~ is removed):
Announce removal.
* lisp/org-compat.el (org-latex-line-break-safe): Make obsolete.

Link: https://orgmode.org/list/878r4jg37s.fsf@posteo.net
2024-01-31 12:35:29 +01:00
Ihor Radchenko bd305ecdf6
ox-latex: Make sure that [text] is not misinterpreted as LaTeX argument
* lisp/ox-latex.el (org-latex-plain-text): Protect plain text starting
from [.  It might be misinterpreted as optional command argument if
previous exported fragment ends with a command accepting such.
*
testing/lisp/test-ox-latex.el (text-ox-latex/protect-square-brackets):
Add new test.

Link: https://orgmode.org/list/87o7dju9vn.fsf@posteo.net
2024-01-31 12:34:21 +01:00
Kyle Meyer 6e17ddd334 Merge branch 'bugfix' 2024-01-20 21:33:37 -05:00
Stefan Kangas 50183ada86 Backport commit 725a3f32f from Emacs
; Fix typos in symbol names
725a3f32f8ba78ac5fffcd03be5b82cbc2c1b275
Stefan Kangas
Sun Jan 14 15:16:54 2024 +0100
2024-01-20 21:25:59 -05:00
Stefan Kangas 6e0fdd1714 Backport commit 6653ee66c from Emacs
* lisp/ox-latex.el (org-latex-src-block-backend)
(org-latex-engraved-theme): Improve docstring; mention that
engrave-faces is a GNU ELPA package.

Improve two docstrings in ox-latex
6653ee66ca5ebd42322613a09d4c0d2e35af924b
Stefan Kangas
Sun Jan 14 14:52:17 2024 +0100
2024-01-20 21:24:44 -05:00
Ihor Radchenko d51723102a
lisp/ox-latex.el: Honor non-list value of `org-latex-caption-above'
* lisp/ox-latex.el (org-latex-generate-engraved-preamble):
(org-latex-latex-environment):  Use
`org-latex--caption-above-p' to query whether an element should have
its caption above.

Reported-by: Mads Bach Villadsen <mbvilladsen@pm.me>
Link: https://orgmode.org/list/m2zfx69uhb.fsf@pm.me
2024-01-16 12:33:01 +01:00
Ihor Radchenko 38c6eb2b72
ox-latex: Do not use float for inline images inside links
* lisp/ox.el (org-export-insert-image-links): Fix call to
`org-element-set-contents' - setting "nil" literally would put an
actual nil element into contents.
* lisp/ox-latex.el (org-latex--inline-image): Do not use float
environment unless the inline image is a single image inside
paragraph.  The code is adapted with simplifications from
`org-html-standalone-image-p'.
* testing/lisp/test-ox-latex.el (test-ox-latex/inline-image): New
test.

Reported-by: Dr. Arne Babenhauserheide <arne_bab@web.de>
Link: https://orgmode.org/list/878rest3qv.fsf@localhost
2024-01-15 13:52:43 +01:00
Kyle Meyer 72a2db86d9 Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Ihor Radchenko 539728840f
ox-latex: Fix exporting longtable with multiline header
* lisp/ox-latex.el (org-latex-table-row): Use all the rows when
constructing header definition.
* testing/lisp/test-ox-latex.el (test-ox-latex/longtable): Add new
test.

Reported-by: Brett Presnell <presnell@member.fsf.org>
Link: https://orgmode.org/list/87mt9zywco.fsf@localhost
2023-12-23 12:03:36 +01:00
Ihor Radchenko ac9acb2113
lisp/ox-latex.el (org-latex--format-spec): Fix checkdoc warning 2023-12-07 11:52:25 +01:00
Ihor Radchenko 29d5b2573b
lisp/ox-latex.el (org-latex--make-option-string): Document all the arguments 2023-12-06 15:18:46 +01:00
Ihor Radchenko bfa4f9d5aa
* lisp/ox-latex.el: Document some undocumented function arguments
(org-latex-generate-engraved-preamble):
(org-latex--remove-packages): Document INFO argument.
2023-11-18 13:18:53 +02:00
Ihor Radchenko ad1aff1722
lisp/ox-latex.el (org-latex-src-block-backend): Fix double space in docstring 2023-11-18 13:18:37 +02:00
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