Revise LaTeX export to make the "include.org" file superfluous

This commit is contained in:
Gerard Vermeulen 2022-11-06 15:53:39 +01:00
parent 7e92472c26
commit 508d8bfeed

View File

@ -7,7 +7,13 @@
#+property: header-args:emacs-lisp :exports code :results silent :tangle init.el #+property: header-args:emacs-lisp :exports code :results silent :tangle init.el
#+property: header-args:org :tangle include.org #+property: header-args:org :tangle include.org
#+startup: showeverything #+startup: showeverything
#+include: "include.org" #+begin_src latex :noweb yes :results raw
,#+latex_header: <<latex-header-1>>
,#+latex_header: <<latex-header-2>>
,#+latex_header: <<latex-header-3>>
,#+latex_header: <<latex-header-4>>
,#+latex_header: <<latex-header-5>>
#+end_src
* Quick start * Quick start
:PROPERTIES: :PROPERTIES:
@ -2989,27 +2995,18 @@ compatibility, because the new way feels less hackish than the old way. A
practical difference is that new way source blocks (contrary to old way export 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. blocks) do not work in [[info:org#Export Settings][#+SETUPFILE: <FILE>]], but only in [[info:org#Export Settings][#+INCLUDE: <FILE>]] files.
*** [[info:org#Export Settings][#+INCLUDE: <FILE> (info)]] *** [[info:org#Macro Replacement][Org-mode macro utilities]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:include-file-usage :CUSTOM_ID: sec:org-macro-utilities
:END: :END:
Listing [[lst:source-file-export-keyword-settings]] shows the preamble lines of this Listing [[lst:by-backend-kbd-org-macro]] defines the Emacs Lisp utilities to
[[file:README.org]] file, where the last line includes [[file:include.org][include.org]]. define the [[https://orgmode.org/][Org mode]] =kbd= macro in listing
#+caption[Source file export keyword settings]:
#+caption: The preamble lines of README.org containing the export keyword
#+caption: settings.
#+name: lst:source-file-export-keyword-settings
#+include: "README.org" src org :lines "1-11"
Listing [[lst:by-backend-kbd-org-macro]] defines the tools for the definition of the
[[https://orgmode.org/][Org mode]] =kbd= macro on the fifth line of listing
[[lst:source-file-export-keyword-settings]]. [[lst:source-file-export-keyword-settings]].
#+attr_latex: :options breaklines #+attr_latex: :options breaklines
#+caption[Define the tools of the =Org-mode= =kbd= macro]: #+caption[Define Emacs Lisp utilities to define the =Org-mode= =kbd= macro]:
#+caption: Define the tools for the =Org-mode= =kbd= macro. #+caption: Define Emacs Lisp utilities to define the =Org-mode= =kbd= macro.
#+name: lst:by-backend-kbd-org-macro #+name: lst:by-backend-kbd-org-macro
#+begin_src emacs-lisp #+begin_src emacs-lisp
(with-eval-after-load 'emacs (with-eval-after-load 'emacs
@ -3028,15 +3025,35 @@ Listing [[lst:by-backend-kbd-org-macro]] defines the tools for the definition of
(latex (format "@@latex:\\colorbox{PowderBlue}{\\texttt{%s}}@@" keys))))) (latex (format "@@latex:\\colorbox{PowderBlue}{\\texttt{%s}}@@" keys)))))
#+end_src #+end_src
Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-header-3]], *** [[info:org#Export Settings][File inclusion (info)]] and [[info:org#Noweb Reference Syntax][Noweb (info)]] trickery
[[lst:use-latex-header-4]], and [[lst:use-latex-header-5]] tangle into the :PROPERTIES:
[[file:include.org][include.org]] file in order to create the [[https://www.latex-project.org/][LaTeX]] preamble. :CUSTOM_ID: sec:file-inclusion-and-noweb
:END:
#+caption[LaTeX preamble: replacing the =Org-mode= default packages]: Listing [[lst:source-file-export-keyword-settings]] shows the preamble lines of this
#+caption: LaTeX preamble: replacing the =Org-mode= default packages. [[file:README.org]] file. It lists the export keyword settings, the definition of
#+name: lst:use-latex-header-1 the [[https://orgmode.org/][Org mode]] =kbd= macro and the source block that generates part of the LaTeX
#+begin_src org preamble. Listing [[lst:latex-header-1]], [[lst:latex-header-2]], [[lst:latex-header-3]],
,#+begin_src latex-header [[lst:latex-header-4]], and [[lst:latex-header-5]] show the LaTeX source blocks that
generate the LaTeX preamble. All listings in this section exists thanks to [[info:org#Export Settings][file
inclusion (info)]] and [[info:org#Noweb Reference Syntax][noweb (info)]] trickery.
#+caption[Source file export keyword settings]:
#+caption: The preamble lines of README.org containing the export keyword
#+caption: settings, the definition of the Org-mode =kbd= macro, and the
#+caption: source block that generates part of the LaTeX preamble.
#+name: lst:source-file-export-keyword-settings
#+include: "README.org" src org :lines "1-17"
#+name: latex-header-1
#+begin_src latex :exports none
% Begin of the LaTeX preamble:
% See: https://list.orgmode.org/87o807r7fr.fsf@posteo.net/
% From: "Juan Manuel Macías" <maciaschain@posteo.net>
% To: orgmode <emacs-orgmode@gnu.org>
% Subject: [tip] Insert arbitrary LaTeX code at the beginning of any float environment
% Date: Sun, 08 May 2022 22:22:16 +0000
% Message-ID: <87o807r7fr.fsf@posteo.net>
% LuaLaTeX-, PdfLaTeX-, or XeTeX-COMPILER COMPATIBILITY: % LuaLaTeX-, PdfLaTeX-, or XeTeX-COMPILER COMPATIBILITY:
% Prevent collisions by using font packages before compiler specific packages. % Prevent collisions by using font packages before compiler specific packages.
\usepackage{ifthen,ifluatex,ifxetex} \usepackage{ifthen,ifluatex,ifxetex}
@ -3063,15 +3080,18 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-
\usepackage[normalem]{ulem} \usepackage[normalem]{ulem}
\usepackage{capt-of} \usepackage{capt-of}
\usepackage{hyperref} \usepackage{hyperref}
% End of the 1st LaTeX header block.
,#+end_src
#+end_src #+end_src
#+caption[LaTeX preamble: language, lists and floats]: #+caption[LaTeX preamble: replacing the =Org-mode= default packages]:
#+caption: LaTeX preamble: language, lists and floats. #+caption: LaTeX preamble: replacing the =Org-mode= default packages.
#+name: lst:use-latex-header-2 #+name: lst:latex-header-1
#+begin_src org #+begin_src latex :exports code :noweb yes
,#+begin_src latex-header <<latex-header-1>>
#+end_src
#+name: latex-header-2
#+begin_src latex :exports none
% LANGUAGE: % LANGUAGE:
\usepackage{babel} \usepackage{babel}
\usepackage{fvextra} \usepackage{fvextra}
@ -3100,15 +3120,18 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-
\usepackage{booktabs} \usepackage{booktabs}
\usepackage{colortbl} \usepackage{colortbl}
\usepackage{tabularx} % DANGER: beware of Org table :width and :align options! \usepackage{tabularx} % DANGER: beware of Org table :width and :align options!
% End of the 2nd LaTeX header block.
,#+end_src
#+end_src #+end_src
#+caption[LaTeX preamble: page layout]: #+caption[LaTeX preamble: language, lists and floats]:
#+caption: LaTeX preamble: page layout. #+caption: LaTeX preamble: language, lists and floats.
#+name: lst:use-latex-header-3 #+name: lst:latex-header-2
#+begin_src org #+begin_src latex :exports code :noweb yes
,#+begin_src latex-header <<latex-header-2>>
#+end_src
#+name: latex-header-3
#+begin_src latex :exports none
% PAGE LAYOUT: % PAGE LAYOUT:
\usepackage{fancyhdr} \usepackage{fancyhdr}
\usepackage{lastpage} \usepackage{lastpage}
@ -3125,15 +3148,18 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-
% TECHNICS: % TECHNICS:
\usepackage{siunitx} \usepackage{siunitx}
\usepackage{tikz} \usepackage{tikz}
% End of the 3rd LaTeX header block.
,#+end_src
#+end_src #+end_src
#+caption[LaTeX preamble: float barriers]: #+caption[LaTeX preamble: page layout and technics]:
#+caption: LaTeX preamble: float barriers. #+caption: LaTeX preamble: page layout.
#+name: lst:use-latex-header-4 #+name: lst:latex-header-3
#+begin_src org #+begin_src latex :exports code :noweb yes
,#+begin_src latex-header <<latex-header-3>>
#+end_src
#+name: latex-header-4
#+begin_src latex :exports none
% FLOAT BARRIERS: % FLOAT BARRIERS:
% https://tex.stackexchange.com/questions/118662/use-placeins-for-subsections % https://tex.stackexchange.com/questions/118662/use-placeins-for-subsections
% Make section an implicit float barrier: % Make section an implicit float barrier:
@ -3153,23 +3179,27 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-
\expandafter\@fb@secFB\subsubsection \expandafter\@fb@secFB\subsubsection
}% }%
} }
\makeatother % End of the 4th LaTeX header block.
,#+end_src
#+end_src #+end_src
#+caption[LaTeX preamble: fancy headers and footers]: #+caption[LaTeX preamble: float barriers]:
#+caption: LaTeX preamble: fancy headers and footers. #+caption: LaTeX preamble: float barriers.
#+name: lst:use-latex-header-5 #+name: lst:latex-header-4
#+begin_src org #+begin_src latex :exports code :noweb yes
,#+begin_src latex-header <<latex-header-4>>
#+end_src
#+name: latex-header-5
#+begin_src latex :exports none
% FANCY HEADERS AND FOOTERS: % FANCY HEADERS AND FOOTERS:
% Add fancy headers and footers to normal pages. % Add fancy headers and footers to normal pages.
\pagestyle{fancy} \pagestyle{fancy}
\fancyhf{} \fancyhf{}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[C]{\emph{ \fancyfoot[C]{\emph{
Emacs setup for use with \LaTeX{}, Org, and Python -- Gerard Vermeulen}} Emacs setup for use with \LaTeX{}, Org, and Python -- Gerard Vermeulen
}
}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headrulewidth}{0.4pt}
\fancyhead[L]{\includegraphics[height=1.8cm]{Org-mode-unicorn.png}} \fancyhead[L]{\includegraphics[height=1.8cm]{Org-mode-unicorn.png}}
\fancyhead[C]{ \fancyhead[C]{
@ -3198,8 +3228,14 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-
} }
\fancyhead[R]{\includegraphics[height=1.8cm]{Emacs-logo.png}} \fancyhead[R]{\includegraphics[height=1.8cm]{Emacs-logo.png}}
} }
% #+latex_header: END. % End of the 5th and last LaTeX header block.
,#+end_src #+end_src
#+caption[LaTeX preamble: fancy headers and footers]:
#+caption: LaTeX preamble: fancy headers and footers.
#+name: lst:latex-header-5
#+begin_src latex :exports code :noweb yes
<<latex-header-5>>
#+end_src #+end_src
*** [[info:org#LaTeX specific export settings][Advanced LaTeX export settings]] *** [[info:org#LaTeX specific export settings][Advanced LaTeX export settings]]
@ -3948,6 +3984,9 @@ Here is a list of links describing how to program and debug [[info:elisp#Top][Em
4. [[http://xahlee.info/talk_show/xah_talk_show_2022-01-20.html][Xah talk show: Elisp coding: xah-add-space-after-comma]] 4. [[http://xahlee.info/talk_show/xah_talk_show_2022-01-20.html][Xah talk show: Elisp coding: xah-add-space-after-comma]]
5. [[http://xahlee.info/talk_show/xah_talk_show_2022-01-22.html][Xah talk show: Elisp coding: narrow-to-region, sort-lines, hilight-unicode]] 5. [[http://xahlee.info/talk_show/xah_talk_show_2022-01-22.html][Xah talk show: Elisp coding: narrow-to-region, sort-lines, hilight-unicode]]
Ref. [cite:@Monnier.ACM-PL.4.1] exposes the evolution of Emacs Lisp and explains
many Emacs Lisp idioms.
** [[https://fennel-lang.org/][Fennel Programming]] ** [[https://fennel-lang.org/][Fennel Programming]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:fennel-programming :CUSTOM_ID: sec:fennel-programming
@ -5073,6 +5112,8 @@ initializes a list of =webjump-sites=.
2. [[https://www.bounga.org/tips/2020/05/03/multiple-smtp-accounts-in-gnus-without-external-tools/][Setting up multiple IMAP and SMTP accounts in Gnus]] 2. [[https://www.bounga.org/tips/2020/05/03/multiple-smtp-accounts-in-gnus-without-external-tools/][Setting up multiple IMAP and SMTP accounts in Gnus]]
3. [[https://jherrlin.github.io/posts/emacs-on-macos-monterey/][Emacs on Macos Monterey]] 3. [[https://jherrlin.github.io/posts/emacs-on-macos-monterey/][Emacs on Macos Monterey]]
4. [[https://github.com/00riddle00/dotfiles/blob/master/.msmtprc][Msmtp resource file for posteo.net]] 4. [[https://github.com/00riddle00/dotfiles/blob/master/.msmtprc][Msmtp resource file for posteo.net]]
5. [[https://www.devdungeon.com/content/gpg-tutorial][GPG tutorial]]
6. [[https://en.wikipedia.org/wiki/Key_server_(cryptographic)#Keyserver_examples][Cryptographic key server examples]]
#+caption[Configure =message=]: #+caption[Configure =message=]:
#+caption: Configure =message=. #+caption: Configure =message=.
@ -5080,7 +5121,7 @@ initializes a list of =webjump-sites=.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(custom-set-variables (custom-set-variables
'(user-full-name "Gerard Vermeulen") '(user-full-name "Gerard Vermeulen")
'(user-mail-address "gerard.vermeulen@neel.cnrs.fr")) '(user-mail-address "gerard.vermeulen@posteo.net"))
(with-eval-after-load 'message (with-eval-after-load 'message
(custom-set-variables (custom-set-variables
'(message-sendmail-envelope-from 'header))) '(message-sendmail-envelope-from 'header)))
@ -5351,7 +5392,7 @@ generation.
Only the [[info:org#Top][Org]] source file shows the local variables footer. Only the [[info:org#Top][Org]] source file shows the local variables footer.
\printbibliography #+print_bibliography:
# Emacs looks for "Local variables:" after the last "newline-formfeed". # Emacs looks for "Local variables:" after the last "newline-formfeed".