[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-mode export to (latex) PDF

From: Juan Manuel Macías
Subject: Re: org-mode export to (latex) PDF
Date: Sat, 10 Jul 2021 17:40:38 +0000

Tim Cross writes:

> Just FYI for those who don't know, you can use the org-latex-classes
> variable to define your own pseudo document classes, possibly using the
> settings. So for example, you can add the babel or other packages you
> want and either make that the 'default' class or specify which class you
> want with the #+LATEX_CLASS header. I use this quite a bit because then
> I don't have to remember which LATEX_HEADER lines to include in the
> document, the specific option settings etc. I don't need support for
> multilingual documents, but I do have a number of 'special' documents
> (such as one with colours, logos and specific fonts for an employer to
> match their 'style guide'. I also have ones for generating project
> documents, letters, meeting minutes etc. They all use various different
> Latex extensions (particularly ones which don't mix well and cannot be
> included with other packages).

I agree. `Org-latex-classes' is a very good option for create LaTeX
templates, and I have a few classes defined as well. The problem is when
you need really long and complex preambles (it is not a problem that
most users may have, though). In a recent project (a book) my preamble
had about 2000 lines (including macros and environments defined by me,
some functions in Lua for LuaTeX, etc.). With long or complex preambles
it's a bit awkward to do it in Elisp and org-latex-classes. In that
case, I usually write the preamble to an Org document and generate a
*.tex file using org-babel-tangle. Then I include that file at the very
beginning of my document with an \input macro. On the LaTeX side, there
is also the option to create your own sty file:

As an alternative to #+LaTeX_Header you can also include the
preamble in the Org document itself using a LaTeX block:

#+NAME: preamble
#+begin_src latex :exports none
... a lot of latex code

and then, in another block with the keyword `:noweb':

#+begin_src latex :noweb yes :results raw
,#+LaTeX_Header: <<preamble>>

(This useful trick came from Charles Berry in this thread:

Best regards,

Juan Manuel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]