From: Tim Cross <theophilusx@gmail.com>
To: William Denton <wtd@pobox.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: #+latex_header blocks, or, managing lots of LaTeX headers
Date: Tue, 12 Apr 2022 16:16:41 +1000 [thread overview]
Message-ID: <87bkx6n6m8.fsf@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2204111958230.78594@shell3.miskatonic.org>
William Denton <wtd@pobox.com> writes:
> I have another question related to managing a book I'm doing building for export to LaTeX:
> what do people do for managing all of the headers?
>
I only use the #+latex_headers or #+latext-headers-extra lines for 'one
off' type documents. If I'm going to be writing lots of documents where
those packages are needed, I define a new org-latex-classes entry.
> It's possible to add a new class to the org-latex-classes variable, and in the documentation on
> it I see there are options ([NO-DEFAULT-PACKAGES], [NO-PACKAGES], [NO-EXTRA]) that allow one to
> trim away all the default headers. That makes it easy to take away, but not to add in lines I
> want, short of managing them in my init file.
The org-latex-classes 'placeholder' macros allow you to add or remove
the headers defined in either the default-packages or packages alist or
headers added via latex_headers/latex_headers_extra. However, the point
to note is that this 'value' is just a string, so you can just put in
exactly what you want - you don't have to use the placeholder macros
(though I almost always do - at least the [default-packages] macro, but
usually the [packages] one as well). The value isn't just restricted to
\usepackage lines either - you can put anything there which makes sense
in the latgex header.
>
> What sorts of practices do people have for managing lots of LaTeX headers? Juan Manuel Macías,
> you mentioned something like this---literate programming in Org to export LaTeX source---may I
> ask how you do it?
>
If I find myself using lots of #+latex_headers lines, this tells me
either
1. I need to update/add to the packages alist variable. This is
especially likely if I'm adding the same headers to every document. Just
add it to the packages alist. I tend to leave the default-packages alist
alone.
2. There is a specific 'style' of document I write often and all
documents of this style have the same additional headers. For this, I
create a new entry in org-latex-classes.
I think adding headers via #+latex_headers and #+latext_headers_extra
should be avoided as much as possible. It is a great escape hatch or for
doing 'on-offs', but not the right approach for doing something like
writing a book.
Consider the situation where you have been adding headers to load
language support or a particular code listing package or whatever. You
writing a book and it will have many org files (perhaps one per
chapter). You add these #+latex_header lines to add the packages. Later,
you find the listing package isn't suitable or you need to modify the
language encoding - now you have to edit every org file which makes up
the book.
Alternatively, you define a new org-latex-classes entry call 'my-book'
and use that to add the language encoding and code listing packages
(along with some other 'tweaks' you typically put in the header, maybe
even add a few custom commands etc). Now when you find it necessary to
change the language encoding, code listing package or whatever, you just
have that one definition to change and only need to edit one file.
next prev parent reply other threads:[~2022-04-12 6:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 0:46 #+latex_header blocks, or, managing lots of LaTeX headers William Denton
2022-04-12 2:51 ` Vikas Rawal
2022-04-12 14:34 ` Kaushal Modi
2022-04-12 6:16 ` Tim Cross [this message]
2022-04-12 8:02 ` Timothy
2022-04-12 8:55 ` Juan Manuel Macías
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkx6n6m8.fsf@gmail.com \
--to=theophilusx@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=wtd@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.