2

I am writing my own latex beamer style. I want to use different background graphics depending on the aspect ratio chosen in the documentclass in the main file, like \documentclass[12pt, aspectratio=169]{beamer}

So how can I access the value of aspectratio in my .sty file?

Philippp
  • 277

1 Answers1

4

One way could be to use the \ifdimcomp{⟨dimen expression⟩}{⟨relation⟩}{⟨dimen expression⟩}{⟨true⟩}{⟨false⟩} macro to test for different paperwidths (and height in case of 169 and 1610):

\documentclass[
    aspectratio=169
%   aspectratio=43
    ]{beamer}

\begin{document}

\makeatletter \ifdimcomp{\beamer@paperwidth}{=}{12.80cm}{43}{} \ifdimcomp{\beamer@paperwidth}{=}{14.85cm}{141}{} \ifdimcomp{\beamer@paperwidth}{=}{13.50cm}{32}{} \ifdimcomp{\beamer@paperwidth}{=}{12.50cm}{54}{} \ifdimcomp{\beamer@paperwidth}{=}{14.00cm}{149}{} \ifdimcomp{\beamer@paperwidth}{=}{16.00cm}{ \ifdimcomp{\beamer@paperheight}{=}{10.00cm}{1610}{} \ifdimcomp{\beamer@paperheight}{=}{9.00cm}{169}{} }{} \makeatother

\end{document}


With the current beamer development version (which should be included in beamer v3.70 or newer), one can now simply use the \insertaspectratio macro:

\documentclass[
    aspectratio=169
%   aspectratio=43
    ]{beamer}

\begin{document}

\begin{frame} \insertaspectratio \end{frame}

\end{document}