Hi again, a follow-up (after a lot of experimentation).
There is a simpler solution than the FONTS_PRE there:
Inserting FONTS between the PACKAGES and the LATEX_HEADER should be enough
(or at least was enough even for the three complex documents I needed to
deal with).
That opens us to some other things like supporting the
\usepackage[AUTO]{babel/polyglossia}
stuff better with a smaller cleanup of the org-latex-guess-* functions and
maybe
inserting the font related code there (to be tested),
while keeping the FONT stuff for fontspec-related code.
WDYT?
/PA
On Sat, 2 May 2026 at 14:59, Ihor Radchenko <[email protected]> wrote:
> Pedro Andres Aranda Gutierrez <[email protected]> writes:
>
> > B. Things that need further thought:
> >
> > 1.- It is advisable to put the sequence
> > BEAMER_THEME_PRE
> > BEAMER_THEME
> > BEAMER_THEME_POST
> > directly after the class declaration. This is what the Beamer authors do
> in
> > their examples.
>
> Sounds reasonable.
>
> > 2.- It is advisable to put "all things font" ASAP.
> > Why? you may have LaTeX code in your header that will be stored with the
> > 'full state' to be called later.
> > An example would be using \savebox{} for certain parts in the header of a
> > document (in LATEX_HEADER).
> > If you change the fonts after declaring the boxes, this declaration has
> no
> > effect in the saved boxes
> > and you will get wrong fonts there. Moving the font packages out of the
> > default classes and
> > into font handling might be helpful.... even for pdflatex.
>
> Except BEAMER_THEME, right?
> So, we do need FONTS_PRE.
>
> > My request:
> > 1. if you want to use templates, make sure there is room for these extra
> > things there to avoid needed patching the generated code with (sometimes
> > intricate) search/replace processes which may not be self-evident in the
> > code. It will be more readable and all (starting by you) will profit
>
> I am open to modifying the default template.
>
> > 2. Agree on a default sequence for Beamer/LaTeX (taking into account
> what I
> > mention above; promise it will help others...):
> >
> > For LaTeX
> > [CLASS-PRE]
> > \documentclass[options]{class}
> > [FONTS]
> > [PACKAGES]
> > [PACKAGES-EXTRA]
> > [HEADER]
> > [HEADER-EXTRA]
>
> I'd say
>
> [CLASS-PRE]
> \documentclass[options]{class}
> [FONTS_PRE]
> [FONTS]
> [DEFAULT-PACKAGES]
> [USER-PACKAGES]
> [HEADER]
> [HEADER-EXTRA]
>
> > And for BEAMER
> > [CLASS-PRE]
> > \documentclass[options]{beamer}
> > [BEAMER-THEME]
> > [FONTS]
> > [PACKAGES]
> > [PACKAGES-EXTRA]
> > [HEADER]
> > [HEADER-EXTRA]
>
> BEAMER-THEME can plug into FONTS_PRE with my idea.
> WDYT?
>
> > PS: I'm sending a PR to https://github.com/fniessen/refcard-org-beamer
> to
> > investigate how that eval-after-load is helpful...
>
> I do not see anything there.
>
> > PPS: Maybe novice users don't want to have to manage that kind of
> > configuration and would be happier without it and with as few setq's as
> > possible. At least that's what my students and colleagues comment.
>
> Yes, of course.
> There is always a tension between configurability for expert users and
> good defaults. Ideally, we should have both... ideally.
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
--
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler
"Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE!
Year 2 of the New Koprocracy