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

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

  •  23-06-2023
  •  | 
  •  

Question

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. 
Était-ce utile?

La solution

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}}%
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top