26

As someone who often gives talks abroad, I usually do not know beforehand which resolutions the projector supports. Thus, I always create both a 4:3 and a 16:9 version of my slides, using e.g.

\documentclass[aspectratio=169]{beamer}

Is there a way to create both without having to change this line? I use pdflatex.

ppq
  • 413
  • since I use pandoc to generate latex anyway, personally I would just add a pandoc template variable in a custom template... and write a two-line bash file to run once pandoc -t latex -V aspectratio=169 and once pandoc -t latex -V aspectratio=43 but that's just me I gues... – mb21 Aug 11 '16 at 16:15

2 Answers2

38

If the body of your talk is in talk.tex then you just need

talk43.tex

\documentclass[aspectratio=43]{beamer}\input{talk}

talk169.tex

\documentclass[aspectratio=169]{beamer}\input{talk}

then use a commandline of

pdflatex talk43;pdflatex talk169
David Carlisle
  • 757,742
10

Referencing Two pdf versions from one single .TEX file?, you can use, for example:

\ifdefined\aspectRatio
\else
    \def\aspectRatio{169}
\fi
\documentclass[aspectratio=\aspectRatio]{beamer}
\usepackage{lipsum}
\begin{document}
\begin{frame}
\lipsum[1]
\end{frame}
\end{document}

and then, assuming your file is beamer-test.tex run either of the following commands:

pdflatex beamer-test
pdflatex "\def\aspectRatio{43}\input{beamer-test.tex}"
pdflatex "\def\aspectRatio{169}\input{beamer-test.tex}"

You can automate the pdf naming convention by using arara, as I detailed in my answer to the post above.

See also, for example,

cmhughes
  • 100,947
  • But you will get only one PDF, beamer-test.pdf, with the last aspect ratio defined. Unfortunately, setting \jobname to something different, eg using \aspectRatio has no effect. But one could rename beamer-test.pdf in between two pdflatex calls within a shell script. – AlexG Aug 12 '16 at 11:47
  • @AlexG hence my link to my previous answer using arara :) run arara once, get two difference pdf files – cmhughes Aug 12 '16 at 12:46
  • Ah, I see. Alright, sorry for the noise. – AlexG Aug 12 '16 at 12:56