emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts)
@ 2024-01-09 12:02 Lennart C. Karssen
  2024-01-09 22:15 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Lennart C. Karssen @ 2024-01-09 12:02 UTC (permalink / raw)
  To: Emacs orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1947 bytes --]

Dear list,

I have been happily using the LaTeX Beamer export for several years. 
Recently, I had to update one of the themes I use for the slides and ran 
into a problem related to the order in which the theme and the LaTeX 
packages are exported to the .tex file.

I use XeLaTeX to compile my documents so I can use fonts like Fira Sans 
in my slides. For this, I load the fontspec package in my Beamer theme 
font file. The Org export code puts the #+BEAMER_THEME options after the 
packages loaded org-latex-packages-alist (and those specified on 
#+LATEX_HEADER lines) in the LaTeX preamble. In my case this gives a 
font problem, because my org-latex-packages-alist loads the polyglossia 
package (which loads the fontspec package needed for the fonts), but my 
beamer theme also tries to load fontspec and somehow (probably related 
to options passed to fontspec), this leads to different (unwanted) 
behaviour.

The desired behaviour would be to have sans-serif math in my equations, 
which works fine if I load my theme before loading other packages (in 
pure LaTeX). However, in the case of Org export, the \usetheme{} 
commands ends up after the \usepackage lines, which leads to serif fonts 
in my equations.

So my questions are basically the following:

1) Is there a way to tell Org to export the #+BEAMER_THEME lines before 
anything else?

2) Is there a reason why the Beamer theme options are exported after 
other LaTeX packages? Wouldn't it be better to export the Beamer theme 
options before loading additional packages? The reason for that being 
that the theme sets defaults, which can then (potentially) be altered by 
loading additional packages.


Best regards,

Lennart Karssen.
-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts)
  2024-01-09 12:02 Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts) Lennart C. Karssen
@ 2024-01-09 22:15 ` Ihor Radchenko
  2024-01-09 22:23   ` Lennart C. Karssen
  2024-02-12 13:20   ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-01-09 22:15 UTC (permalink / raw)
  To: Lennart C. Karssen
  Cc: Emacs orgmode, Daniel Fleischer, Leo Butler,
	Juan Manuel Macías

"Lennart C. Karssen" <lennart@karssen.org> writes:

> 1) Is there a way to tell Org to export the #+BEAMER_THEME lines before 
> anything else?

Yes. You can customize "beamer" class in `org-latex-classes' or define a
custom (for example, "my-beamer") class and add #+LATEX_CLASS: my-beamer
to the Org file.

This will give you full control over the preamble layout.

> 2) Is there a reason why the Beamer theme options are exported after 
> other LaTeX packages? Wouldn't it be better to export the Beamer theme 
> options before loading additional packages? The reason for that being 
> that the theme sets defaults, which can then (potentially) be altered by 
> loading additional packages.

No specific reason that I am aware of.
Your suggestion sounds reasonable, but I'd like to hear from our LaTeX
experts first ;)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts)
  2024-01-09 22:15 ` Ihor Radchenko
@ 2024-01-09 22:23   ` Lennart C. Karssen
  2024-02-12 13:20   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Lennart C. Karssen @ 2024-01-09 22:23 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1296 bytes --]

Dear Igor,

Thanks for your reply.

On 09-01-2024 22:15, Ihor Radchenko wrote:
> "Lennart C. Karssen" <lennart@karssen.org> writes:
> 
>> 1) Is there a way to tell Org to export the #+BEAMER_THEME lines before
>> anything else?
> 
> Yes. You can customize "beamer" class in `org-latex-classes' or define a
> custom (for example, "my-beamer") class and add #+LATEX_CLASS: my-beamer
> to the Org file.

Ah, indeed, I hadn't thought of that taking route. I will give it a try.

> 
> This will give you full control over the preamble layout.
> 
>> 2) Is there a reason why the Beamer theme options are exported after
>> other LaTeX packages? Wouldn't it be better to export the Beamer theme
>> options before loading additional packages? The reason for that being
>> that the theme sets defaults, which can then (potentially) be altered by
>> loading additional packages.
> 
> No specific reason that I am aware of.
> Your suggestion sounds reasonable, but I'd like to hear from our LaTeX
> experts first ;)

Of course. Let's see what they have to say.


Lennart.

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts)
  2024-01-09 22:15 ` Ihor Radchenko
  2024-01-09 22:23   ` Lennart C. Karssen
@ 2024-02-12 13:20   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-02-12 13:20 UTC (permalink / raw)
  To: Lennart C. Karssen
  Cc: Emacs orgmode, Daniel Fleischer, Leo Butler,
	Juan Manuel Macías

Ihor Radchenko <yantar92@posteo.net> writes:

>> 2) Is there a reason why the Beamer theme options are exported after 
>> other LaTeX packages? Wouldn't it be better to export the Beamer theme 
>> options before loading additional packages? The reason for that being 
>> that the theme sets defaults, which can then (potentially) be altered by 
>> loading additional packages.
>
> No specific reason that I am aware of.
> Your suggestion sounds reasonable, but I'd like to hear from our LaTeX
> experts first ;)

Thinking about this more, I am afraid that changing the loading order
may break the existing documents. Similar to your case when loading
beamer theme after other packages produces different behavior, loading
beamer theme _before_ may have unwanted side effects.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-12 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 12:02 Org LaTeX Beamer export and the order of loading packages and theme (XeLaTeX and fonts) Lennart C. Karssen
2024-01-09 22:15 ` Ihor Radchenko
2024-01-09 22:23   ` Lennart C. Karssen
2024-02-12 13:20   ` Ihor Radchenko

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).