Tweak the sections on easy LaTeX preamble editing

This commit is contained in:
Gerard Vermeulen 2024-01-22 12:57:41 +01:00
parent 2f209b6f2c
commit 0ee204a8ad

View File

@ -3896,7 +3896,7 @@ Examples: `ob/' or `ob-maxima'."
(ert text)))))
#+end_src
*** [[info:org#Noweb Reference Syntax][Noweb (info)]] trickery
*** LaTex preamble editing using [[info:org#Noweb Reference Syntax][Noweb (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:file-inclusion-and-noweb
:END:
@ -4113,15 +4113,17 @@ handled by [[info:org#Noweb Reference Syntax][noweb (info)]].
<<latex-header-5>>
#+end_src
*** [[info:org#LaTeX header and sectioning][Deprecated easy LaTeX preamble editing methods]]
*** [[info:org#LaTeX header and sectioning][Deprecated LaTeX preamble editing methods]]
:PROPERTIES:
:CUSTOM_ID: sec:easy-latex-preamble-editing
:END:
There are at least two deprecated (old and historic) ways to edit the LaTeX
preamble =latex_header= and =latex_extra_header= export options easily in LaTeX
source or export blocks. This [[info:org#Top][Org (info)]] file uses the recommended method of
noweb trickery in Section [[#sec:file-inclusion-and-noweb]].
*NOTE:* This [[info:org#Top][Org (info)]] file uses the recommended method of noweb trickery in
Section [[#sec:file-inclusion-and-noweb]].
There are at least two deprecated (old and historic) ways to edit the Org
=#+latex_header:= and =#+latex_extra_header:= keywords easily
for export to LaTeX, see [[info:org#LaTeX header and sectioning][LaTeX header and sectioning (info)]].
The old way -- exploiting an idea of [[https://www.matem.unam.mx/~omar/][Omar Antolin Camarena]] -- is to code new
[[info:org#Editing Source Code][<LANGUAGE>-modes]] allowing to edit in LaTeX mode and to export to LaTeX code with
@ -4133,6 +4135,17 @@ exposing his idea:
Listing [[lst:org-babel-latex-header-blocks]] implements this way by means of two
new [[info:org#Editing Source Code][<LANGUAGE>-modes]]: =latex-header= and =latex-extra-header=.
The old way is to define two Org Babel languages (=latex-extra-header= and
=latex-header=) as done in Listing [[lst:org-babel-latex-header-blocks]]. The
historic way is to use a special export attribute as in the function
=org-latex-header-blocks-filter= in [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra.el][ox-extra.el]]. Apparently, nobody is using
this broken function (broken, since it relies on support only in org-mode before
=2014-11-11=). Listing [[lst:org-latex-header-blocks-filter]] proposes a fix for
=org-latex-header-blocks-filter=. This setup keeps the deprecated ways for
backwards compatibility. A practical difference is that new way source blocks
(contrary to old way export blocks) do not work in [[info:org#Export Settings][#+SETUPFILE: <FILE>]], but only
in [[info:org#Export Settings][#+INCLUDE: <FILE>]] files.
#+caption[New =<LANGUAGE>-modes= to edit the LaTeX preamble easily]:
#+caption: Add =latex-header= and =latex-extra-header= language modes to edit
#+caption: LaTeX preamble =latex_header= and =latex_extra_header= export options
@ -4171,12 +4184,6 @@ prefixes all lines with \"#+latex_header: \"."
(add-to-list 'org-src-lang-modes '("latex-extra-header" . latex))))
#+end_src
The historic way is to use a special export attribute as in the function
=org-latex-header-blocks-filter= in [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra.el][ox-extra.el]]. Apparently, nobody is using
this broken function (broken, since it relies on support only in org-mode before
=2014-11-11=). Listing [[lst:org-latex-header-blocks-filter]] proposes a fix for
=org-latex-header-blocks-filter=.
#+caption[Convert marked LaTeX export blocks to LaTeX header lines]:
#+caption: Convert marked LaTeX export blocks to LaTeX header lines.
#+name: lst:org-latex-header-blocks-filter
@ -4227,11 +4234,6 @@ converts to
org-export-before-parsing-functions))
#+end_src
This file uses the new most simple way, while keeping the deprecated ways for
backwards compatibility. A practical difference is that new way source blocks
(contrary to old way export blocks) do not work in [[info:org#Export Settings][#+SETUPFILE: <FILE>]], but only
in [[info:org#Export Settings][#+INCLUDE: <FILE>]] files.
*** [[info:org#HTML Export][HTML export (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:html-export