8

I would like to add two figures figures to a beamer slide, one on top of the other. Is there a simple command, similar to \linewidth or \textwidth for the height? The figures have dimensions roughly twice as wide as they are tall. I would like them to use the full vertical space without encroaching on the title/controls. If their dimensions were reverse, I would put them side by side using width=0.5\linewidth. I am not sure the height analog.

Here is what I am using now. As an alternative, I use the \paperhieght but then have to visually check that the chosen scale factor left enough room for the title and controls at the bottom.

 \begin{frame}{4$\times$167 gH5 in 10 mM K$^{+}$: Comparison}
  \begin{center}
    \includegraphics[height=0.4\paperheight]{figures/array_models/i1_r_c000_4x167_h5_k010_33_fit}\\
    \onslide<2>{
      \includegraphics[height=0.4\paperheight]{figures/array_models/i1_r_best1000_c000_4x167_h5_k010_33_fit}
    }
  \end{center}
\end{frame}

In addition to having to check the scale factor, this also has the disadvantage that it must be changed if I add/remove the frame title or switch to a different theme. If there I instead used the available slide height, it may not need to be updated.

  • \textheight ? – cfr Nov 16 '15 at 3:02
  • 1
    @cfr, For some reason I thought that would be the same as the \lineheight but that is what I was looking for. You want to make it an answer (simple as it is)? – Steven C. Howell Nov 16 '15 at 3:07
  • To be honest, I didn't even know there was a \lineheight. I don't think I've ever used it ;). – cfr Nov 16 '15 at 3:12
  • @cfr, actually, no, \textheight is larger than the available space (I forgot to change 0.4 to 0.5 before recompiling). Still not sure if there is a command for the available space in the slide. – Steven C. Howell Nov 16 '15 at 3:14
  • 1
    You want \beamer@frametextheight, maybe. But I think it is calculated on a per frame basis. Because the height of the title box is expected to vary and, indeed, whether there is a title at all. – cfr Nov 16 '15 at 3:30
8

@cfr is right. The dimension \beamer@frametextheight is calculated very lately. In fact, this dimension is used at only two places: \framezoom and shrink. Thus one has two ways to utilize the full vertical space.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame{{use \tt\string\framezoom}
    \framezoom<1><2>(0cm,0cm)(5cm,5cm)
    \tikz\draw(0,0)grid(5,5);
}
\frame{{use \tt shrink}
    \centering
    \tikz\draw(0,0)grid(20,20);
}
\frame[shrink]{{use \tt shrink}
    \centering
    \tikz\draw(0,0)grid(20,20);
}
\end{document}

However it is annoying that the contents are not centered. One might want to check beamerbaseframesize.sty and modify the calculation by themselves.

One might use the hook used by shrink but, instead, fill in the content they want.

\makeatletter
\frame{{use hook from \tt shrink}
    \global\beamer@shrinktrue
    \gdef\beamer@shrinkframebox{
        \setbox\beamer@framebox=\vbox to\beamer@frametextheight{
            \centering
            \tikz[font={\tt}]\draw(0,0)node[above left]{(0,0)}rectangle(4,\beamer@frametextheight)node[below right]{(4,\string\beamer@frametextheight)}(2,.5\beamer@frametextheight)circle(.05)node[right]{(2,.5\string\beamer@frametextheight)};
        }
    }
}
  • This is incredibly close to what I am looking for but not quite. If you look at the images you uploaded, the images on the right for "use \framezoom" and "use \frameshrink", the boxes overlap the navigation controls. This may be the closest it gets though... – Steven C. Howell Nov 18 '15 at 22:19
  • @stvn66 (For some reason I missed your comment.) \framezoom and frameshrink are official hooks --- this suggests that Beamer just does not care the navigation bar at all and thus ignores its height. You may either (1) do the height-calculation yourself, (2) put it somewhere by editing templates, or (3) turn it off once and for all. – Symbol 1 Dec 1 '15 at 14:29
  • In my limited experiences, it is pretty difficult to utilize the navigation bar. For short documents it is useless. For long documents it is better to have a good TOC: clicking a specific [[sub]sub]section is more intuitive than going to prev/next [[sub]sub]section. – Symbol 1 Dec 1 '15 at 14:34
  • As it seems no one has any other idea, I also concluded that there was no height variable that considered this. Thanks for the post. Hopefully it helps others as well. – Steven C. Howell Dec 1 '15 at 14:36
  • @stvn66 The height of navigation symbols (I said "bar" above, which is something else) can be found in beamerbasenavigation.sty. It is 7pt. But there are implicit margins/paddings so the exact number does not help. – Symbol 1 Dec 1 '15 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.