6

I am trying to create a template for making smartphone-compatible (VERTICAL) beamer slides in Latex. Although this can be achieved (to read in landscape mode) by

\documentclass[aspectratio=169]{beamer}

I wish to make a template for making beamer slides which can be read in portrait mode. Although I am not a pro in Latex yet, I tried editing some lines in the beamer.cls file

\DeclareOptionBeamer{aspectratio}[43]{%
\ifnum#1=1610 %
\setlength\beamer@paperwidth{16.00cm}%
\setlength\beamer@paperheight{10.00cm}%
\else\ifnum#1=169 %
\setlength\beamer@paperwidth{16.00cm}%
\setlength\beamer@paperheight{9.00cm}%

To these lines I added

\else\ifnum#1=916 %
\setlength\beamer@paperwidth{9cm}%
\setlength\beamer@paperheight{16cm}%

However, on using

\documentclass[aspectratio=916]{beamer}

the layout gives the default 4:3 output. What am I doing wrong? Is there an easier way to achieve this?

7
  • 1
    Welcome to TeX.SX! What you did (plus adding one more \fi at the end of that block) should work. Make sure that you edited a copy of beamer.cls and that you put it somewhere TeX can find. Commented Sep 25, 2019 at 16:46
  • 1
    Thank you! Adding the extra \fi did the trick! I forgot to add that I did not use the main beamer.cls file. I made a copy in the working directory, renamed it as mobview.cls and then made the changes. Now it works. Thanks again!
    – ntk47
    Commented Sep 25, 2019 at 17:03
  • @PhelypeOleinik Would you like to add an answer?
    – CarLaTeX
    Commented Oct 1, 2019 at 19:19
  • @CarLaTeX Thanks, but I'm not at home right now. If you want to answer, please do :-) Commented Oct 1, 2019 at 20:04
  • @PhelypeOleinik No hurry, please answer when you have time, just to remove the question from the unanswered list :)
    – CarLaTeX
    Commented Oct 1, 2019 at 20:49

2 Answers 2

4

As requested; to add a new geometry setting to beamer, first make sure you are changing a local copy of beamer.cls. You can see where the file is in your computer by looking at the beginning of log:

(c:/texlive/2019/texmf-dist/tex/latex/beamer/beamer.cls
Document Class: beamer 2019/09/29 v3.57 A class for typesetting presentations

then copy that file to the current directory. Rename it if you prefer. Then open the file and look for something like this:

\DeclareOptionBeamer{aspectratio}[43]{%
  \ifnum#1=1610 %
    \setlength\beamer@paperwidth{16.00cm}%
    \setlength\beamer@paperheight{10.00cm}%
  \else\ifnum#1=169 %
    \setlength\beamer@paperwidth{16.00cm}%
    \setlength\beamer@paperheight{9.00cm}%
  <...>
  \fi\fi<...>

Here the aspectratio is the option name and [43] is the default value. To add a new option, duplicate one block from one \else\ifnum to the next and change it as you want:

  \else\ifnum#1=916 %
    \setlength\beamer@paperwidth{9.00cm}%
    \setlength\beamer@paperheight{16.00cm}%

and then make sure to add an extra \fi to the end. The whole thing should look like this:

\DeclareOptionBeamer{aspectratio}[43]{%
  \ifnum#1=1610 %
    \setlength\beamer@paperwidth{16.00cm}%
    \setlength\beamer@paperheight{10.00cm}%
  \else\ifnum#1=169 %
    \setlength\beamer@paperwidth{16.00cm}%
    \setlength\beamer@paperheight{9.00cm}%
  \else\ifnum#1=149 %
    \setlength\beamer@paperwidth{14.00cm}%
    \setlength\beamer@paperheight{9.00cm}%
  \else\ifnum#1=54 %
    \setlength\beamer@paperwidth{12.50cm}%
    \setlength\beamer@paperheight{10.00cm}%
  \else\ifnum#1=43 %
    \setlength\beamer@paperwidth{12.80cm}%
    \setlength\beamer@paperheight{9.60cm}%
  \else\ifnum#1=32 %
    \setlength\beamer@paperwidth{13.50cm}%
    \setlength\beamer@paperheight{9.00cm}%
  \else\ifnum#1=141 %
    \setlength\beamer@paperwidth{14.85cm}%
    \setlength\beamer@paperheight{10.50cm}%
  \else\ifnum#1=916 %                        <
    \setlength\beamer@paperwidth{9.00cm}%     | One more option
    \setlength\beamer@paperheight{16.00cm}%  <
  \fi\fi\fi\fi\fi\fi\fi
  \fi % One more \fi
}

Then using it:

\documentclass[aspectratio=916]{beamer}
\usepackage{lipsum}
\begin{document}
\begin{frame}{Lorem Ipsum}
\lipsum[1]
\end{frame}
\end{document}

produces:

enter image description here

2

Internally, beamer uses the geometry package to set the page dimensions. So you can tell geometry to turn the page using the landscape option -- this option doesn't force landscape, what it does is swap the height and width of the page.

Because beamer loads the geometry package, you have to use the \PassOptionsToPackage method of getting the landscape option to the geometry package.

(This only works if your desired page size is simply a rotation of an existing one. If you want an entirely new page size, you'd need the solution from the answer of Phelype Oleinik.)

\PassOptionsToPackage{landscape}{geometry}
\documentclass{beamer}

\usetheme{Warsaw}

\begin{document}

\begin{frame}{A Portrait Presentation}
\begin{theorem}
Theorems are easier to prove in portrait orientation.
\end{theorem}
\begin{proof}
This frame is its own proof.
\end{proof}
\end{frame}
\end{document}

Beamer presentation in portrait orientation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .