13

The problem I have is simple to describe: the height of a beamer slide title does not seem to be subtracted from \textheight, leaving me with no idea how much space is left for the actual content.

A quick example:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}{Title}
\begin{tikzpicture}
\draw[red] (0,0) rectangle (\textwidth,\textheight);
\draw[blue] (0,\textheight) -- (\textwidth,0)
            (0,0) -- (\textwidth, \textheight);
\end{tikzpicture}
\end{frame}
\end{document}

Compiled with <code>pdflatex</code>

So, is this a bug, or am I using it wrong or misunderstanding it? How would I go on about with drawing the above rectangle with the correct height?

Caesar
  • 231
  • 2
    This is correct, text height and width does not really have the same interpretation in beamer as in a normal document. – daleif Aug 03 '17 at 12:36
  • Hmm, after some tests in beamer, it seems \textheight is a lot taller inside tikzpicture than it is on the beamer frame. No idea why – daleif Aug 03 '17 at 12:44
  • Here is an exercise: \begin{tikzpicture}[overlay, remember picture] \draw[red] (current page.south west) rectangle (\textwidth,0.3\textheight);\end{tikzpicture}. Why do I need such a small height for the rectangle for the square to be seen. – daleif Aug 03 '17 at 12:47
  • 1
    related discussion about textheight: https://tex.stackexchange.com/a/383020/36296 – samcarter_is_at_topanswers.xyz Aug 03 '17 at 12:47
  • 2
    Possible duplicates: https://tex.stackexchange.com/questions/278429/is-there-a-simple-command-for-the-available-height-in-a-beamer-slide https://tex.stackexchange.com/questions/44218/set-image-to-full-all-available-space-in-beamer-without-overlapping-other-eleme – samcarter_is_at_topanswers.xyz Aug 03 '17 at 14:06

1 Answers1

3

The \textheight of a beamer frame includes the title, so you likely want something like

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}%{Title}
\begin{tikzpicture}
\draw[red] (0,0) rectangle (\textwidth,\textheight);
\draw[blue] (0,\textheight) -- (\textwidth,0)
            (0,0) -- (\textwidth, \textheight);
\end{tikzpicture}
\end{frame}
\end{document}

You might also consider using a plain frame and the \paperheight.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 1
    Unfortunately, I do want a title on my slide. And I want to know the space/height I have remaining for content. – Caesar Aug 03 '17 at 13:48
  • Joseph, do you know why the example I gave in the comment above require such a small height for the rectangle to be visible? I tested what beamer said about the height of the beamer frame, and \textheight was almost identical to it, but still I needed a rectangle height that is 30% of the text height. – daleif Aug 03 '17 at 13:59