1

Doesn't it bother anybody that the beamer class doesn't perfectly center the contents of frames vertically?

There is a bit more space below than above. Could anybody provide a solution on how to achieve a perfectly centered content and, more importantly, to make this the global setting?

Below is a (trivial) MWE.

\documentclass{beamer}

\begin{document}
    \begin{frame}
        This text is not perfectly centered vertically.
    \end{frame}
\end{document}
2

The textpos package lets you put your text at any position you specify on the page. In beamer class, the package must be loaded with the overlay option, this is not the case in other document classes. I also turned on the showboxes option just to compare with the perfect center calculated by tikz. In your final document, you can remove the showboxes option, or, add the \textblockrulecolor{white} command to hide the boxes. The latter command in my experience resulted in a more accurate positioning. But I have no idea why this was the case.

\documentclass{beamer}
\usepackage{tikz,lmodern}
\usepackage[absolute,overlay,showboxes]{textpos}
\begin{document}
\centering
\begin{frame}{title}
  This text is not perfectly centered vertically.
  \begin{tikzpicture}[overlay, remember picture]
    \draw (current page.north west)--(current page.south east) (current page.south west)--(current page.north east);
  \end{tikzpicture}

  \begin{textblock}{13.5}[.5,.5](8,8)
    This text is perfectly centered vertically and horizontally.
  \end{textblock}    
\end{frame}

\end{document}

enter image description here

1

This doesn't answer your main question, although I suspect that there are some hidden "margins" for titles, headers, footers, etc. which are not seen on an empty frame. In any case, if you insist in having some text perfectly centered, you can always use TiKZ.

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}{title}
        This text is not perfectly centered vertically.
        \begin{tikzpicture}[overlay, remember picture] \node[anchor=center,draw] at (current page.center) {This text is perfectly centered vertically and horizontally.};
        \draw (current page.north west)--(current page.south east) (current page.south west)--(current page.north east);
        \end{tikzpicture}
\end{frame}
\end{document}

enter image description here

  • Thanks for your answer, but I don't think that this provides a proper solution to my problem. Like this I would have to put a tikzpicture environment inside each of my frames. What I am looking for is something to put in the preamble so that it works globally on all frames and every kind of content (I don't know if I could put anything inside a tikzpicture environment). – finaslonchas Feb 12 '16 at 20:29

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.