9

This question already has an answer here:

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?

marked as duplicate by Mensch, Stefan Pinnow, flav, user121799, Sebastiano Jan 22 at 7:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    This is correct, text height and width does not really have the same interpretation in beamer as in a normal document. – daleif Aug 3 '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 3 '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 3 '17 at 12:47
  • 1
    related discussion about textheight: tex.stackexchange.com/a/383020/36296 – user36296 Aug 3 '17 at 12:47
  • 2
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.

  • Unfortunately, I do want a title on my slide. And I want to know the space/height I have remaining for content. – Caesar Aug 3 '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 3 '17 at 13:59

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