365 lines
24 KiB
HTML
365 lines
24 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html>
|
|||
|
<head>
|
|||
|
<meta charset="utf-8">
|
|||
|
<title>2021-06-34-relaxed.org.html</title>
|
|||
|
<style>
|
|||
|
body { background: #fafafa; color: #2a2a2a; }
|
|||
|
pre {
|
|||
|
font-size: 1rem;
|
|||
|
max-width: min(100rem, 100%);
|
|||
|
width: max-content;
|
|||
|
white-space: pre-wrap;
|
|||
|
margin: auto; }
|
|||
|
.ef-D {
|
|||
|
color: #2a2a2a;
|
|||
|
background-color: #fafafa;
|
|||
|
font-weight: 400; }
|
|||
|
.ef-k {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-d {
|
|||
|
color: #b6b6b6; }
|
|||
|
.ef-t {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-s {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-w {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-b {
|
|||
|
color: #29838d; }
|
|||
|
.ef-ct {
|
|||
|
color: #b1b1b1; }
|
|||
|
.ef-c {
|
|||
|
color: #97365b; }
|
|||
|
.ef-pp {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-nc {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-v {
|
|||
|
color: #cb9aad; }
|
|||
|
.ef-f {
|
|||
|
color: #29838d; }
|
|||
|
.ef-cd {
|
|||
|
color: #b1b1b1; }
|
|||
|
.ef-rc {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-rb {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-ob {
|
|||
|
}
|
|||
|
.ef-hn {
|
|||
|
color: #97365b;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-hq {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-hs {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-rdi {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-rdii {
|
|||
|
color: #97365b; }
|
|||
|
.ef-rdiii {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-rdiv {
|
|||
|
color: #842879; }
|
|||
|
.ef-rdv {
|
|||
|
color: #29838d; }
|
|||
|
.ef-rdvi {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-rdvii {
|
|||
|
color: #97365b; }
|
|||
|
.ef-rdiix {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-rdix {
|
|||
|
color: #842879; }
|
|||
|
</style>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<pre>
|
|||
|
<span style="color: #9e9e9e;">#+title:</span> <span style="color: #29838d; font-weight: 700;">June 2021
|
|||
|
</span><span style="color: #9e9e9e;">#+subtitle:</span> <span style="color: #29838d;">A relaxed month
|
|||
|
</span><span style="color: #9e9e9e;">#+author:</span> <span style="color: #29838d;">TEC
|
|||
|
</span><span style="color: #9e9e9e;">#+date:</span> <span style="color: #29838d;">2021-06-34
|
|||
|
</span>
|
|||
|
The previous two months have been pretty good for Org development --- with many
|
|||
|
bug fixes and feature improvements. This month has been substantially slower
|
|||
|
than the last<span style="color: #ac4426;">[fn:1]</span>, but that's not to say not much is happening: in fact, there are
|
|||
|
some rather nifty contributions lined up for the not-too-distant future and a
|
|||
|
certain long-awaited feature branch<span style="color: #ac4426;">[fn:2]</span> is getting very close to merging 😀.
|
|||
|
You'll just have to stick around to hear about those in a future edition of TMIO 😉.
|
|||
|
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">It's right around the corner, I swear!</span>
|
|||
|
<span style="color: #b6b6b6;">#+attr_html: :class invertible</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/dilbert-zenos-paradox.jpg]]</span>
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Customise the reference command used in LaTeX</span>
|
|||
|
|
|||
|
Previously, whenever you linked to another part of your document (with or
|
|||
|
without giving it a name) --- for example with <span style="color: #4f894c;">=</span><span style="color: #4f894c; font-weight: 700;">[[Profound section]]</span><span style="color: #4f894c;">=</span> or similar
|
|||
|
--- when exporting to LaTeX Org would <span style="text-decoration: italic;">/always/</span> use the <span style="color: #4f894c;">=\ref=</span> command.
|
|||
|
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">A LaTeX export of a simple document with a reference to both the first and second section.</span>
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">"2" what? Section 2, Table 2, Figure 2, ...</span>
|
|||
|
<span style="color: #b6b6b6;">#+attr_html: :class invertible</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/org-latex-default-reference-to-sec.png]]</span>
|
|||
|
|
|||
|
You can now set the format string <span style="color: #ac4426;">~org-latex-reference-command~</span> (<span style="color: #4f894c;">=\\ref{%s}=</span> by
|
|||
|
default) to anything you'd like. For example, making use of the <span style="color: #3b6ea8; font-weight: 700;">[[https://ctan.org/pkg/cleveref][cleveref]]</span> package
|
|||
|
I can set this to <span style="color: #4f894c;">=\\cref{%s}=</span> and then add <span style="color: #9e9e9e;">src_</span><span style="color: #b6b6b6;">elisp</span><span style="color: #9e9e9e;">{</span><span class="ef-ob">(</span><span style="color: #4f894c;">"capitalize"</span> <span style="color: #4f894c;">"cleveref"</span><span class="ef-ob">
|
|||
|
nil)</span><span style="color: #9e9e9e;">}</span><span style="color: #ac4426;">[fn:3]</span> to <span style="color: #ac4426;">~org-latex-packages-alist~</span>.
|
|||
|
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">A LaTeX export of the same document, but now using ~cleveref~. Note the change from "1" and "2" to "Section 1" and "Section 2".</span>
|
|||
|
<span style="color: #b6b6b6;">#+attr_html: :class invertible</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/org-latex-cref-reference-to-sec.png]]</span>
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* A diversion into writing Org for LaTeX</span>
|
|||
|
|
|||
|
Speaking of LaTeX exports, a member of the Org mailing list recently told us
|
|||
|
about <span style="color: #3b6ea8; font-weight: 700;">[[https://arxiv.org/abs/2106.05096][a paper]]</span> pushed to <span style="color: #3b6ea8; font-weight: 700;">[[https://arxiv.org/][arXiv]]</span> which was written <span style="text-decoration: italic;">/entirely/</span> in Org. Why don't we
|
|||
|
use that as a prompt to talk a bit about generating LaTeX documents from Org?
|
|||
|
|
|||
|
For an experienced LaTeX-er, Org may initially appear best suited to simple
|
|||
|
documents, but in fact it's possible to reproduce any LaTeX structure in Org
|
|||
|
with no more difficulty (often less) than in LaTeX.
|
|||
|
|
|||
|
<span style="color: #97365b; font-weight: 700;">** Simple elements</span>
|
|||
|
|
|||
|
The "basic" Org elements are simply translated to their LaTeX counterparts.
|
|||
|
Markup like <span style="font-weight: 700;">*bold*</span>, <span style="text-decoration: italic;">/italic/</span>, etc. are simply translated through
|
|||
|
<span style="color: #ac4426;">~org-latex-text-markup-alist~</span>.
|
|||
|
|
|||
|
For those of us who dabble with equations, Org is <span style="color: #3b6ea8; font-weight: 700;">[[https://orgmode.org/manual/LaTeX-fragments.html][very accomodating]]</span>. You can
|
|||
|
type (LaTeX-style) inline and display equations in exactly the same way (<span style="color: #4f894c;">=\( \)=</span>
|
|||
|
and <span style="color: #4f894c;">=\[ \]=</span>), and what's more, if you have a LaTeX environment statement
|
|||
|
<span style="color: #4f894c;">=\begin{...}=</span> on its own line, Org will recognise it and pass it into the
|
|||
|
generated LaTeX.
|
|||
|
|
|||
|
<span style="color: #97365b; font-weight: 700;">** Figures and tables</span>
|
|||
|
|
|||
|
One area where the improvement when moving to Org is particularly apparent is
|
|||
|
with figures and tables. To simply include an image, an image link alone is
|
|||
|
sufficient.
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span style="color: #3b6ea8; font-weight: 700;">[[file:figures/salvador-dali-persistence-of-memory.jpg]]</span>
|
|||
|
<span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>When exported to LaTeX this will be expanded to
|
|||
|
<span style="color: #b1b1b1;">#+begin_src LaTeX
|
|||
|
</span><span style="color: DimGray;">\includegraphics</span><span class="ef-ob">[width=.9</span><span style="color: DimGray;">\linewidth</span><span class="ef-ob">]{figures/salvador-dali-persistence-of-memory.jpg}
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
As soon as you add a <span style="color: #4f894c;">=#+caption=</span>, though, Org knows you mean business and
|
|||
|
generates a <span style="text-decoration: italic;">/proper/</span> figure.
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+caption: A famous surrealist painting
|
|||
|
</span><span style="color: #3b6ea8; font-weight: 700;">[[file:figures/salvador-dali-persistence-of-memory.jpg]]</span>
|
|||
|
<span style="color: #b1b1b1;">#+end_src
|
|||
|
</span><span style="color: #b1b1b1;">#+begin_src LaTeX
|
|||
|
</span><span style="color: #3b6ea8;">\begin</span><span class="ef-ob">{</span><span style="color: #29838d;">figure</span><span class="ef-ob">}[htbp]
|
|||
|
</span><span style="color: #3b6ea8;">\centering</span>
|
|||
|
<span style="color: DimGray;">\includegraphics</span><span class="ef-ob">[width=.9</span><span style="color: DimGray;">\linewidth</span><span class="ef-ob">]{figures/salvador-dali-persistence-of-memory.jpg}
|
|||
|
</span><span style="color: #3b6ea8;">\caption</span><span class="ef-ob">{</span><span style="color: #9a7500;">A famous surrealist painting</span><span class="ef-ob">}
|
|||
|
</span><span style="color: #3b6ea8;">\end</span><span class="ef-ob">{</span><span style="color: #29838d;">figure</span><span class="ef-ob">}
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
As you may have guessed from the fact this works without a LaTeX-specific
|
|||
|
keyword, this works nicely in HTML too 🙂.
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">A famous surrealist painting</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/salvador-dali-persistence-of-memory.jpg]]</span>
|
|||
|
|
|||
|
The LaTeX backend also accepts additional image attributes (<span style="color: #3b6ea8; font-weight: 700;">[[https://orgmode.org/manual/Images-in-LaTeX-export.html][manual page]]</span>). For
|
|||
|
example, to set the image width I can simply add
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+attr_latex: :width 0.4\linewidth
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>above the image link.
|
|||
|
|
|||
|
You can do the same with tables:
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+caption: A selection of famous paintings by Salvador Dalí
|
|||
|
</span><span style="color: #842879;">| Year | Painting |</span>
|
|||
|
<span style="color: #842879;">|------+----------------------------|</span>
|
|||
|
<span style="color: #842879;">| 1931 | The persistence of memory |</span>
|
|||
|
<span style="color: #842879;">| 1937 | Swans reflecting elephants |</span>
|
|||
|
<span style="color: #842879;">| 1837 | Metamorphosis of narcissus |</span>
|
|||
|
<span style="color: #842879;">| 1952 | Galatea of the spheres |</span>
|
|||
|
<span style="color: #842879;">| 1966 | Tuna fishing |</span>
|
|||
|
<span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
I like to set <span style="color: #9e9e9e;">src_</span><span style="color: #b6b6b6;">elisp</span><span style="color: #9e9e9e;">{</span><span class="ef-ob">(</span><span style="color: #3b6ea8;">setq</span><span class="ef-ob"> org-latex-tables-booktabs t)</span><span style="color: #9e9e9e;">}</span> to use the nice
|
|||
|
<span style="color: #4f894c;">=booktabs=</span> rules in the generated tables. Just remember to ensure the <span style="color: #4f894c;">=booktabs=</span>
|
|||
|
package is loaded.
|
|||
|
|
|||
|
<span style="color: #b1b1b1;">#+begin_src LaTeX
|
|||
|
</span><span style="color: #3b6ea8;">\begin</span><span class="ef-ob">{</span><span style="color: #29838d;">table</span><span class="ef-ob">}[htbp]
|
|||
|
</span><span style="color: #3b6ea8;">\caption</span><span class="ef-ob">{</span><span style="color: #9a7500;">A selection of famous paintings by Salvador Dalí</span><span class="ef-ob">}
|
|||
|
</span><span style="color: #3b6ea8;">\centering</span>
|
|||
|
<span style="color: #3b6ea8;">\begin</span><span class="ef-ob">{</span><span style="color: #29838d;">tabular</span><span class="ef-ob">}{rl}
|
|||
|
</span><span style="color: DimGray;">\toprule</span><span class="ef-ob">
|
|||
|
Year </span><span style="color: #9a7500;">&</span><span class="ef-ob"> Painting</span><span style="color: #9a7500;">\\</span>
|
|||
|
<span style="color: DimGray;">\midrule</span><span class="ef-ob">
|
|||
|
1931 </span><span style="color: #9a7500;">&</span><span class="ef-ob"> The persistence of memory</span><span style="color: #9a7500;">\\</span><span class="ef-ob">
|
|||
|
1937 </span><span style="color: #9a7500;">&</span><span class="ef-ob"> Swans reflecting elephants</span><span style="color: #9a7500;">\\</span><span class="ef-ob">
|
|||
|
1837 </span><span style="color: #9a7500;">&</span><span class="ef-ob"> Metamorphosis of narcissus</span><span style="color: #9a7500;">\\</span><span class="ef-ob">
|
|||
|
1952 </span><span style="color: #9a7500;">&</span><span class="ef-ob"> Galatea of the spheres</span><span style="color: #9a7500;">\\</span><span class="ef-ob">
|
|||
|
1966 </span><span style="color: #9a7500;">&</span><span class="ef-ob"> Tuna fishing</span><span style="color: #9a7500;">\\</span>
|
|||
|
<span style="color: DimGray;">\bottomrule</span>
|
|||
|
<span style="color: #3b6ea8;">\end</span><span class="ef-ob">{</span><span style="color: #29838d;">tabular</span><span class="ef-ob">}
|
|||
|
</span><span style="color: #3b6ea8;">\end</span><span class="ef-ob">{</span><span style="color: #29838d;">table</span><span class="ef-ob">}
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
Org is nice and does the right thing^{TM} by including the caption at the top.
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">Look ma, I put the caption in the right place.</span>
|
|||
|
<span style="color: #b6b6b6;">#+attr_html: :class invertible</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/org-table-to-latex-example.png]]</span>
|
|||
|
|
|||
|
There are also some <span style="color: #3b6ea8; font-weight: 700;">[[https://orgmode.org/manual/Images-in-LaTeX-export.html][more attributes]]</span> you can supply to tables. Should I want the
|
|||
|
table to spread out I could use <span style="color: #4f894c;">=#+attr_latex: :environment tabularx=</span> (as long as
|
|||
|
I've loaded the <span style="color: #4f894c;">=tabularx=</span> package) and then set the columns with <span style="color: #4f894c;">=:align lX=</span>.
|
|||
|
|
|||
|
<span style="color: #97365b; font-weight: 700;">** Code blocks</span>
|
|||
|
|
|||
|
By default, source code blocks are translated verbatim. We can do better than
|
|||
|
that however. We can tell Org to use <span style="color: #3b6ea8; font-weight: 700;">[[https://ctan.org/pkg/listings][listings]]</span>, but I'd recommend going one step
|
|||
|
further and using <span style="color: #3b6ea8; font-weight: 700;">[[https://ctan.org/pkg/minted][minted]]</span>. For this to work we need to perform three actions:
|
|||
|
+ Tell Org we want to use <span style="color: #4f894c;">=minted=</span> environments for source code
|
|||
|
+ Load the <span style="color: #4f894c;">=minted=</span> package by default
|
|||
|
+ Add <span style="color: #4f894c;">=-shell-escape=</span> to our LaTeX compiler flags, so <span style="color: #4f894c;">=minted=</span> may call <span style="color: #3b6ea8; font-weight: 700;">[[https://pygments.org/][pygments]]</span>.
|
|||
|
|
|||
|
This can easily be accomplished via the following snippet:
|
|||
|
<span style="color: #b1b1b1;">#+begin_src emacs-lisp
|
|||
|
</span><span class="ef-ob">(</span><span style="color: #3b6ea8;">setq</span><span class="ef-ob"> org-latex-listings 'minted
|
|||
|
</span><span style="color: #b1b1b1;">;; </span><span style="color: #b1b1b1;">as long as you have latexmk installed
|
|||
|
</span><span class="ef-ob"> org-latex-pdf-process
|
|||
|
'(</span><span style="color: #4f894c;">"latexmk -f -pdf -%latex -shell-escape -interaction=nonstopmode -output-directory=%o %f"</span><span class="ef-ob">))
|
|||
|
(add-to-list 'org-latex-packages-alist '(</span><span style="color: #4f894c;">""</span> <span style="color: #4f894c;">"minted"</span><span class="ef-ob">))
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
To customise <span style="color: #4f894c;">=minted=</span>, as well as inserting content into the <span style="color: #3b6ea8; font-weight: 700;">[[Preamble content][preamble]]</span>, one can
|
|||
|
also customise <span style="color: #ac4426;">~org-latex-minted-options~</span> to control what options are applied to
|
|||
|
each <span style="color: #4f894c;">=minted=</span> environment.
|
|||
|
|
|||
|
<span style="color: #97365b; font-weight: 700;">** Custom environments</span>
|
|||
|
|
|||
|
Org has a number of <span style="color: #3b6ea8; font-weight: 700;">[[https://orgmode.org/manual/Blocks.html][blocks]]</span> which are treated specially, like <span style="color: #4f894c;">=#+begin_src=</span> for
|
|||
|
source code, and <span style="color: #4f894c;">=#+begin_centre=</span> for centred text. When exporting this same
|
|||
|
syntax allows you to wrap Org content in any LaTeX environments (as long as it
|
|||
|
doesn't match one of Org's recognised environments).
|
|||
|
|
|||
|
For example, if you wrote a <span style="color: #4f894c;">=warning=</span> environment in LaTeX to box and emphasise
|
|||
|
text, to wrap some Org content in it one simply needs to write:
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+begin_warning
|
|||
|
Pay close attention! This is very important.
|
|||
|
,#+end_warning
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>and the content will be wrapped in <span style="color: #4f894c;">=\begin{warning} ... \end{warning}=</span>.
|
|||
|
|
|||
|
<span style="color: #97365b; font-weight: 700;">** The LaTeX escape hatches</span>
|
|||
|
|
|||
|
Should there be a particular LaTeX command you wish to insert somewhere, you
|
|||
|
simply need to put it on its own line with <span style="color: #4f894c;">=#+latex:=</span> in front and it will be
|
|||
|
transferred to the generated LaTeX (this works with other formats too).
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+latex: \newpage
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
For larger snippets of LaTeX, there's always the export block.
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+begin_export latex
|
|||
|
\cleardoublepage
|
|||
|
\vfil
|
|||
|
\hfil This page is intentionally left blank \hfil
|
|||
|
\vfil
|
|||
|
\newpage
|
|||
|
,#+end_export
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
<span style="color: #97365b; font-weight: 700;">** Preamble content</span>
|
|||
|
|
|||
|
Should you wish to include the line in the preamble (before <span style="color: #4f894c;">=\begin{document}=</span>),
|
|||
|
then all you need to do is use <span style="color: #4f894c;">=#+latex_header:=</span>.
|
|||
|
<span style="color: #b1b1b1;">#+begin_src org
|
|||
|
</span><span class="ef-ob">,#+latex_header: \newcommand{\RR}{\mathbb{R}}
|
|||
|
,#+latex_header: \usepackage{svg} % so that </span><span style="color: #3b6ea8; font-weight: 700;">[[file:*.svg]]</span><span class="ef-ob"> works nicely
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>This is great for adding one-off <span style="color: #4f894c;">=\usepackage=</span> commands, but what if you find
|
|||
|
yourself wanting a package (like <span style="color: #3b6ea8; font-weight: 700;">[[https://ctan.org/pkg/svg][svg]]</span>) to be always included? Well the we have
|
|||
|
the aforementioned <span style="color: #ac4426;">~org-latex-packages-alist~</span> which will include the packages
|
|||
|
set when exporting; you can even set some packages to only be included when
|
|||
|
using a certain LaTeX compiler.
|
|||
|
|
|||
|
Should you want to use a certain preset preamble, you can make use of the
|
|||
|
<span style="color: #4f894c;">=#+latex_class=</span> keyword. This is used to set the base preamble template used when
|
|||
|
generating the LaTeX. See <span style="color: #ac4426;">~org-latex-classes~</span> for what's available by default. You
|
|||
|
should see entries for:
|
|||
|
+ article
|
|||
|
+ report
|
|||
|
+ book
|
|||
|
+ beamer
|
|||
|
|
|||
|
One of these is always used when generating LaTeX; when no <span style="color: #4f894c;">=#+latex_class=</span> is set
|
|||
|
in the document, the template named by <span style="color: #ac4426;">~org-latex-default-class~</span> will be used.
|
|||
|
|
|||
|
What's great about this is that is makes it really easy to add your own
|
|||
|
templates. Each template simply takes three components:
|
|||
|
1. A name
|
|||
|
2. A preamble template
|
|||
|
3. A series of format strings to translate headings to LaTeX, with and without numbering
|
|||
|
|
|||
|
For example, I'm quite a fan of the <span style="color: #3b6ea8; font-weight: 700;">[[https://ctan.org/pkg/koma-script][KOMA-script]]</span> family. Should I want to add a
|
|||
|
<span style="color: #4f894c;">=kart=</span> class (for: <span style="font-weight: 700;">*k*</span>oma <span style="font-weight: 700;">*art*</span>icle), I simply need to do something like the
|
|||
|
following:
|
|||
|
<span style="color: #b1b1b1;">#+begin_src emacs-lisp
|
|||
|
</span><span class="ef-ob">(add-to-list 'org-latex-classes
|
|||
|
'(</span><span style="color: #4f894c;">"kart"</span> <span style="color: #b1b1b1;">; </span><span style="color: #b1b1b1;">class name
|
|||
|
</span> <span style="color: #4f894c;">"\\documentclass{scrartcl}"</span> <span style="color: #b1b1b1;">; </span><span style="color: #b1b1b1;">preamble template
|
|||
|
</span><span class="ef-ob"> (</span><span style="color: #4f894c;">"\\section{%s}"</span><span class="ef-ob"> . </span><span style="color: #4f894c;">"\\section*{%s}"</span><span class="ef-ob">) </span><span style="color: #b1b1b1;">; </span><span style="color: #b1b1b1;">H1 translation
|
|||
|
</span><span class="ef-ob"> (</span><span style="color: #4f894c;">"\\subsection{%s}"</span><span class="ef-ob"> . </span><span style="color: #4f894c;">"\\subsection*{%s}"</span><span class="ef-ob">) </span><span style="color: #b1b1b1;">; </span><span style="color: #b1b1b1;">H2 translation
|
|||
|
</span><span class="ef-ob"> (</span><span style="color: #4f894c;">"\\subsubsection{%s}"</span><span class="ef-ob"> . </span><span style="color: #4f894c;">"\\subsubsection*{%s}"</span><span class="ef-ob">) </span><span style="color: #b1b1b1;">; </span><span style="color: #b1b1b1;">H3...
|
|||
|
</span><span class="ef-ob"> (</span><span style="color: #4f894c;">"\\paragraph{%s}"</span><span class="ef-ob"> . </span><span style="color: #4f894c;">"\\paragraph*{%s}"</span><span class="ef-ob">)
|
|||
|
(</span><span style="color: #4f894c;">"\\subparagraph{%s}"</span><span class="ef-ob"> . </span><span style="color: #4f894c;">"\\subparagraph*{%s}"</span><span class="ef-ob">)))
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
See the documentation for <span style="color: #ac4426;">~org-latex-classes~</span> for more information on how the
|
|||
|
preamble template in handled.
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Other improvements</span>
|
|||
|
+ <span style="color: #4f894c;">=ox-koma-letter.el=</span> has been brought into Org's main directory from the ) <span style="color: #4f894c;">=contrib/=</span> repo _Bastien Guerry_
|
|||
|
+ Speed up publishing by using delayed hooks and temp buffers instead of finding
|
|||
|
files _Gustav Wikström_
|
|||
|
+ Improve generated HTML quality: prevent W3C warning and add some accessibility
|
|||
|
labels _TEC_
|
|||
|
+ Make the behaviour of the "goto variant" of <span style="color: #ac4426;">~org-refile~</span> (<span style="color: #ac4426;">~org-speed-commands~</span>)
|
|||
|
less confusing _Marco Wahl_
|
|||
|
+ Backport an update to the OpenDocument schema _Kyle Meyer_
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Bugfixes</span>
|
|||
|
+ Off by one error in texinfo menu generation _Nicolas Goaziou_
|
|||
|
+ Error in entry/conversion of non-24h times in the agenda _Nicolas Goaziou_
|
|||
|
+ Only use <span style="color: #ac4426;">~replace-buffer-contents~</span> with Emacs 27+ when saving src blocks, as the
|
|||
|
behaviour isn't consistent until then _Nicolas Goaziou_
|
|||
|
+ Prevent "before first headline" error in <span style="color: #4f894c;">=org-clock=</span> when clocking out _Nicolas Goaziou_
|
|||
|
+ Avoid setting the global agenda name when following a timestamp link _Ingo Lohmar_
|
|||
|
+ Don't bind <span style="color: #4f894c;">=<tab>=</span> in <span style="color: #ac4426;">~org-mode-map~</span> _Nicolas Goaziou_
|
|||
|
+ Erroneous tangling of source block with <span style="color: #4f894c;">=:tangle no=</span> to a file <span style="color: #4f894c;">=no=</span> when the
|
|||
|
tangle command is called with a single universal argument _Jacopo De Simoi_
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Footnotes</span>
|
|||
|
|
|||
|
<span style="color: #ac4426;">[fn:1]</span> As has been the writing of this blog post 😜
|
|||
|
|
|||
|
<span style="color: #ac4426;">[fn:2]</span> First-class support for citations is coming to Org! With support for <span style="color: #3b6ea8; font-weight: 700;">[[https://citationstyles.org/][CSL]]</span>
|
|||
|
and <span style="color: #3b6ea8; font-weight: 700;">[[https://en.wikipedia.org/wiki/BibTeX][BibTeX]]</span>, with a number of citation processors 🙌. Soon^{TM}
|
|||
|
|
|||
|
<span style="color: #ac4426;">[fn:3]</span> I'm rather a fan of the <span style="color: #4f894c;">=capitalize=</span> option because (1) technically the
|
|||
|
reference to a named object is a proper noun, and (2) this means you don't have
|
|||
|
to worry about references not being capitalized when appearing at the start of a
|
|||
|
sentence.
|
|||
|
|
|||
|
</pre>
|
|||
|
<body>
|
|||
|
</html>
|