diff --git a/README.org b/README.org index 28498c7..ff98783 100644 --- a/README.org +++ b/README.org @@ -7,7 +7,13 @@ #+property: header-args:emacs-lisp :exports code :results silent :tangle init.el #+property: header-args:org :tangle include.org #+startup: showeverything -#+include: "include.org" +#+begin_src latex :noweb yes :results raw + ,#+latex_header: <> + ,#+latex_header: <> + ,#+latex_header: <> + ,#+latex_header: <> + ,#+latex_header: <> +#+end_src * Quick start :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 blocks) do not work in [[info:org#Export Settings][#+SETUPFILE: ]], but only in [[info:org#Export Settings][#+INCLUDE: ]] files. -*** [[info:org#Export Settings][#+INCLUDE: (info)]] +*** [[info:org#Macro Replacement][Org-mode macro utilities]] :PROPERTIES: -:CUSTOM_ID: sec:include-file-usage +:CUSTOM_ID: sec:org-macro-utilities :END: -Listing [[lst:source-file-export-keyword-settings]] shows the preamble lines of this -[[file:README.org]] file, where the last line includes [[file:include.org][include.org]]. - -#+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 +Listing [[lst:by-backend-kbd-org-macro]] defines the Emacs Lisp utilities to +define the [[https://orgmode.org/][Org mode]] =kbd= macro in listing [[lst:source-file-export-keyword-settings]]. #+attr_latex: :options breaklines -#+caption[Define the tools of 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]: +#+caption: Define Emacs Lisp utilities to define the =Org-mode= =kbd= macro. #+name: lst:by-backend-kbd-org-macro #+begin_src emacs-lisp (with-eval-after-load 'emacs @@ -3028,144 +3025,195 @@ Listing [[lst:by-backend-kbd-org-macro]] defines the tools for the definition of (latex (format "@@latex:\\colorbox{PowderBlue}{\\texttt{%s}}@@" keys))))) #+end_src -Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex-header-3]], -[[lst:use-latex-header-4]], and [[lst:use-latex-header-5]] tangle into the -[[file:include.org][include.org]] file in order to create the [[https://www.latex-project.org/][LaTeX]] preamble. +*** [[info:org#Export Settings][File inclusion (info)]] and [[info:org#Noweb Reference Syntax][Noweb (info)]] trickery +:PROPERTIES: +:CUSTOM_ID: sec:file-inclusion-and-noweb +:END: + +Listing [[lst:source-file-export-keyword-settings]] shows the preamble lines of this +[[file:README.org]] file. It lists the export keyword settings, the definition of +the [[https://orgmode.org/][Org mode]] =kbd= macro and the source block that generates part of the LaTeX +preamble. Listing [[lst:latex-header-1]], [[lst:latex-header-2]], [[lst:latex-header-3]], +[[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" + % To: orgmode + % 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: + % Prevent collisions by using font packages before compiler specific packages. + \usepackage{ifthen,ifluatex,ifxetex} + \ifthenelse{\boolean{luatex}}{ + \usepackage{fontspec} % lualatex + }{\ifthenelse{\boolean{xetex}}{ + \usepackage{mathspec} % xetex + }{ + \usepackage[T1]{fontenc} % pdflatex + \usepackage[utf8]{inputenc} % pdflatex + } + } + \usepackage{amsmath} + \usepackage{amssymb} + \usepackage{pifont} % check mark (\ding{52}) and cross mark (\ding{56}) + \usepackage{textcomp} % \texttimes + \usepackage{wasysym} % \diameter + + % Org-mode REQUIREMENTS: + \usepackage{graphicx} + \usepackage{longtable} + \usepackage{wrapfig} + \usepackage{rotating} + \usepackage[normalem]{ulem} + \usepackage{capt-of} + \usepackage{hyperref} + % End of the 1st LaTeX header block. +#+end_src #+caption[LaTeX preamble: replacing the =Org-mode= default packages]: #+caption: LaTeX preamble: replacing the =Org-mode= default packages. -#+name: lst:use-latex-header-1 -#+begin_src org - ,#+begin_src latex-header - % LuaLaTeX-, PdfLaTeX-, or XeTeX-COMPILER COMPATIBILITY: - % Prevent collisions by using font packages before compiler specific packages. - \usepackage{ifthen,ifluatex,ifxetex} - \ifthenelse{\boolean{luatex}}{ - \usepackage{fontspec} % lualatex - }{\ifthenelse{\boolean{xetex}}{ - \usepackage{mathspec} % xetex - }{ - \usepackage[T1]{fontenc} % pdflatex - \usepackage[utf8]{inputenc} % pdflatex - } - } - \usepackage{amsmath} - \usepackage{amssymb} - \usepackage{pifont} % check mark (\ding{52}) and cross mark (\ding{56}) - \usepackage{textcomp} % \texttimes - \usepackage{wasysym} % \diameter +#+name: lst:latex-header-1 +#+begin_src latex :exports code :noweb yes + <> +#+end_src - % Org-mode REQUIREMENTS: - \usepackage{graphicx} - \usepackage{longtable} - \usepackage{wrapfig} - \usepackage{rotating} - \usepackage[normalem]{ulem} - \usepackage{capt-of} - \usepackage{hyperref} +#+name: latex-header-2 +#+begin_src latex :exports none + % LANGUAGE: + \usepackage{babel} + \usepackage{fvextra} + \usepackage{csquotes} - ,#+end_src + % LISTS: + \usepackage{enumitem} + \setlist{noitemsep} + + % LISTINGS: + % Section 2.6 of caption-eng.pdf (texdoc caption) explains that the sign + % of "skip" depends on the assumption "position=above" or "position=below". + % The assumption should match the real caption position in the LaTeX code. + \usepackage{caption} + \usepackage[newfloat]{minted} + \captionsetup[listing]{position=below,skip=0em} + \usemintedstyle{xcode} + + % TABLES: + % https://tex.stackexchange.com/questions/341205/ + % what-is-the-difference-between-tabular-tabular-and-tabularx-environments + % https://emacs.stackexchange.com/questions/26179/ + % change-org-mode-table-style-just-for-latex-export + % https://tex.stackexchange.com/questions/468585/ + % table-formatting-using-siunitx + \usepackage{booktabs} + \usepackage{colortbl} + \usepackage{tabularx} % DANGER: beware of Org table :width and :align options! + % End of the 2nd LaTeX header block. #+end_src #+caption[LaTeX preamble: language, lists and floats]: #+caption: LaTeX preamble: language, lists and floats. -#+name: lst:use-latex-header-2 -#+begin_src org - ,#+begin_src latex-header - % LANGUAGE: - \usepackage{babel} - \usepackage{fvextra} - \usepackage{csquotes} - - % LISTS: - \usepackage{enumitem} - \setlist{noitemsep} - - % LISTINGS: - % Section 2.6 of caption-eng.pdf (texdoc caption) explains that the sign - % of "skip" depends on the assumption "position=above" or "position=below". - % The assumption should match the real caption position in the LaTeX code. - \usepackage{caption} - \usepackage[newfloat]{minted} - \captionsetup[listing]{position=below,skip=0em} - \usemintedstyle{xcode} - - % TABLES: - % https://tex.stackexchange.com/questions/341205/ - % what-is-the-difference-between-tabular-tabular-and-tabularx-environments - % https://emacs.stackexchange.com/questions/26179/ - % change-org-mode-table-style-just-for-latex-export - % https://tex.stackexchange.com/questions/468585/ - % table-formatting-using-siunitx - \usepackage{booktabs} - \usepackage{colortbl} - \usepackage{tabularx} % DANGER: beware of Org table :width and :align options! - - ,#+end_src +#+name: lst:latex-header-2 +#+begin_src latex :exports code :noweb yes + <> #+end_src -#+caption[LaTeX preamble: page layout]: +#+name: latex-header-3 +#+begin_src latex :exports none + % PAGE LAYOUT: + \usepackage{fancyhdr} + \usepackage{lastpage} + \usepackage[ + headheight=20mm, + top=40mm, + bottom=20mm, + left=0.1\paperwidth, + right=0.1\paperwidth, + heightrounded, + verbose, + ]{geometry} + + % TECHNICS: + \usepackage{siunitx} + \usepackage{tikz} + % End of the 3rd LaTeX header block. +#+end_src + +#+caption[LaTeX preamble: page layout and technics]: #+caption: LaTeX preamble: page layout. -#+name: lst:use-latex-header-3 -#+begin_src org - ,#+begin_src latex-header - % PAGE LAYOUT: - \usepackage{fancyhdr} - \usepackage{lastpage} - \usepackage[ - headheight=20mm, - top=40mm, - bottom=20mm, - left=0.1\paperwidth, - right=0.1\paperwidth, - heightrounded, - verbose, - ]{geometry} +#+name: lst:latex-header-3 +#+begin_src latex :exports code :noweb yes + <> +#+end_src - % TECHNICS: - \usepackage{siunitx} - \usepackage{tikz} - - ,#+end_src +#+name: latex-header-4 +#+begin_src latex :exports none + % FLOAT BARRIERS: + % https://tex.stackexchange.com/questions/118662/use-placeins-for-subsections + % Make section an implicit float barrier: + \usepackage[section]{placeins} + % Make subsection an implicit float barrier: + \makeatletter + \AtBeginDocument{% + \expandafter\renewcommand\expandafter\subsection\expandafter{% + \expandafter\@fb@secFB\subsection + }% + } + \makeatother + % Make subsubsection an implicit float barrier: + \makeatletter + \AtBeginDocument{% + \expandafter\renewcommand\expandafter\subsubsection\expandafter{% + \expandafter\@fb@secFB\subsubsection + }% + } + % End of the 4th LaTeX header block. #+end_src #+caption[LaTeX preamble: float barriers]: #+caption: LaTeX preamble: float barriers. -#+name: lst:use-latex-header-4 -#+begin_src org - ,#+begin_src latex-header - % FLOAT BARRIERS: - % https://tex.stackexchange.com/questions/118662/use-placeins-for-subsections - % Make section an implicit float barrier: - \usepackage[section]{placeins} - % Make subsection an implicit float barrier: - \makeatletter - \AtBeginDocument{% - \expandafter\renewcommand\expandafter\subsection\expandafter{% - \expandafter\@fb@secFB\subsection - }% - } - \makeatother - % Make subsubsection an implicit float barrier: - \makeatletter - \AtBeginDocument{% - \expandafter\renewcommand\expandafter\subsubsection\expandafter{% - \expandafter\@fb@secFB\subsubsection - }% - } - \makeatother - - ,#+end_src +#+name: lst:latex-header-4 +#+begin_src latex :exports code :noweb yes + <> #+end_src -#+caption[LaTeX preamble: fancy headers and footers]: -#+caption: LaTeX preamble: fancy headers and footers. -#+name: lst:use-latex-header-5 -#+begin_src org - ,#+begin_src latex-header - % FANCY HEADERS AND FOOTERS: - % Add fancy headers and footers to normal pages. - \pagestyle{fancy} +#+name: latex-header-5 +#+begin_src latex :exports none + % FANCY HEADERS AND FOOTERS: + % Add fancy headers and footers to normal pages. + \pagestyle{fancy} + \fancyhf{} + \renewcommand{\footrulewidth}{0.4pt} + \fancyfoot[C]{\emph{ + Emacs setup for use with \LaTeX{}, Org, and Python -- Gerard Vermeulen + } + } + \renewcommand{\headrulewidth}{0.4pt} + \fancyhead[L]{\includegraphics[height=1.8cm]{Org-mode-unicorn.png}} + \fancyhead[C]{ + Page: \thepage/\pageref{LastPage} \\ + \text{ } \\ + \text{ } \\ + DRAFT + } + \fancyhead[R]{\includegraphics[height=1.8cm]{Emacs-logo.png}} + + % Add fancy header and footer to custom titlepage. + % https://tex.stackexchange.com/questions/506102/ + % adding-header-and-footer-to-custom-titlepage + \fancypagestyle{titlepage}{% \fancyhf{} \renewcommand{\footrulewidth}{0.4pt} \fancyfoot[C]{\emph{ @@ -3173,33 +3221,21 @@ Listing [[lst:use-latex-header-1]], [[lst:use-latex-header-2]], [[lst:use-latex- \renewcommand{\headrulewidth}{0.4pt} \fancyhead[L]{\includegraphics[height=1.8cm]{Org-mode-unicorn.png}} \fancyhead[C]{ - Page: \thepage/\pageref{LastPage} \\ + \pageref{LastPage} pages \\ \text{ } \\ \text{ } \\ DRAFT } \fancyhead[R]{\includegraphics[height=1.8cm]{Emacs-logo.png}} + } + % End of the 5th and last LaTeX header block. +#+end_src - % Add fancy header and footer to custom titlepage. - % https://tex.stackexchange.com/questions/506102/ - % adding-header-and-footer-to-custom-titlepage - \fancypagestyle{titlepage}{% - \fancyhf{} - \renewcommand{\footrulewidth}{0.4pt} - \fancyfoot[C]{\emph{ - Emacs setup for use with \LaTeX{}, Org, and Python -- Gerard Vermeulen}} - \renewcommand{\headrulewidth}{0.4pt} - \fancyhead[L]{\includegraphics[height=1.8cm]{Org-mode-unicorn.png}} - \fancyhead[C]{ - \pageref{LastPage} pages \\ - \text{ } \\ - \text{ } \\ - DRAFT - } - \fancyhead[R]{\includegraphics[height=1.8cm]{Emacs-logo.png}} - } - % #+latex_header: END. - ,#+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 + <> #+end_src *** [[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]] 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]] :PROPERTIES: :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]] 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]] +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=. @@ -5080,7 +5121,7 @@ initializes a list of =webjump-sites=. #+begin_src emacs-lisp (custom-set-variables '(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 (custom-set-variables '(message-sendmail-envelope-from 'header))) @@ -5351,7 +5392,7 @@ generation. 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".