configure org-mode to use one package if compile with beamer another else (article)

StackOverflow https://stackoverflow.com/questions/22708353

  •  23-06-2023
  •  | 
  •  

Pregunta

I want to use one package if I compile with beamer or another one if I compile with pdflatex (org-latex-pdf-process):

if compile-with-beamer:
  \usepackage{my_beamer_package}
else:
  \usepackage{my_article_package}

NB:

C-c C-e l P     (org-beamer-export-to-pdf)
    Export as LaTeX and then process to PDF. 
¿Fue útil?

Solución

A possible starting point: use the LaTeX macro \@ifclassloaded. More precisely, in your org file use a local package

#+LATEX_HEADER: \usepackage{myPackage}

and in this package have the following code:

\@ifclassloaded{beamer}
  {\usepackage{my_beamer_package}}
  {\usepackage{my_article_package}}%
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top