emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: William Denton <wtd@pobox.com>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: #+latex_header blocks, or, managing lots of LaTeX headers
Date: Tue, 12 Apr 2022 08:55:59 +0000	[thread overview]
Message-ID: <878rsar880.fsf@posteo.net> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2204111958230.78594@shell3.miskatonic.org> (William Denton's message of "Mon, 11 Apr 2022 20:46:36 -0400 (EDT)")

Hi William,

William Denton writes:

> 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?

When it comes to a large project, for example the typesetting of a book,
I usually generate all the configuration for LaTeX in a *.tex document or
a *.sty document from Org, using literate programming[1]. I include there all
the LaTeX packages I use, their configuration, my own LaTeX or Lua code
(because I use LuaTeX to compile), etc. Here is a screenshot of a  part of
the configuration I wrote for the Hispanic Dictionary of the Classical
Tradition:

https://i.imgur.com/fwonZtT.png

I also have an 'empty' class added to the org-latex-classes list, and then
load my LaTeX configuration via \input. When it comes to large books I
also use org-publish, which makes it easier for me to work with complex
projects and multi-part/chapter books.

Another possibility, to avoid adding many lines with 'LaTeX_Header:', is
to use blocks and the noweb keyword. For example: you can create a
non-exportable node in your document, and put all the necessary
configuration there. You include all the LaTeX preamble in a block:

* Configuration           :noexport:

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

And in another block you add this:

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

(in this thread you can find an org document attached with this procedure:
https://list.orgmode.org/87sfwvlp56.fsf@posteo.net/)
----------------------------

[1] In fact, Org is much more powerful and simpler for doing these
things than the docstript suite itself that is 'officially' used in the
(La)TeX ecosystem to generate packages code and documentation:
https://ctan.org/pkg/docstrip?lang=en

Best regards,

Juan Manuel 


      parent reply	other threads:[~2022-04-12  8:57 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
2022-04-12  8:02 ` Timothy
2022-04-12  8:55 ` Juan Manuel Macías [this message]

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rsar880.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).