# change code according to Beamer 'aspectratio'

I already search for beamerand aspectratio. I have found How to automatically create 4:3 AND 16:9 versions of my LaTeX Beamer slides?, which comes near to my problem, but does not solve it.

I sometimes do have to switch back to an old device with 4:3 aspect ratio. It is no problem, to change the aspectratio switch in my document preamble and rerun LaTeX. While this gives me adequate slides in 98 % of the time, there are some slides, which get overfull \hbox errors.

Is there a way to get around this problem, by having two different LaTeX code blocks, one which is choosen, if the aspectratio is given as =169 and one, when it is defined as =43?

Something like

\ifx{aspectratio}{43}
code special to\\
this ratio
\else
normal code with longer lines
\fi


would help a lot.

• You can easily define your own bool command e.g. with etoolbox. – Ulrike Fischer Nov 13 '17 at 10:46

Maybe as a workaround:

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

\begin{document}
test

\ifnum\aspectratio=169 %
foo
\else
bar
\fi

\end{document}