16

With a regular article/report/... class, you can use the showframe package to draw outlines of where the various regions of the page lie. I cannot get the same functionality with beamer, however. Using geometry with its showframe option similarly does not work.

How can I get this functionality with beamer?

MWE:

\documentclass{beamer}

%\usepackage[showframe]{geometry}  % Doesn't work
\usepackage{showframe}             % Doesn't work

\begin{document}

\begin{frame}{Slide Title}
\centering
Centered Text
\end{frame}

\end{document}

Edit:

A similar question is posed here that asks for a diagram depicting the layout of the page with lengths of various parameters given. The \layout package gives this output when applied to the MWE:

layout

While this output gives margin information and general layout information, it does not give the visual output that I am looking for, with boxes overlaid on my own content. I am less interested in seeing the value of margins and other lengths than I am in visualizing the fit of my own content on the slide and seeing how close the boxes actually are to content. This is why I desire functionality more close to what the showframe package would provide.

1

1 Answer 1

11
+50

I applied to beamer the answer at Displaying layout marks in a document set with different layouts, which gives some of the information you seek. It shades the main text block, that margin block, the header block, and the footer block.

However, the beamer frame sits atop the underlying page dimensions, and so things like the frame title are not captured by the normal page text blocks. Further, things like \marginpars can be done in beamer, but not inside a frame. Lastly, there are some page dimensions such as \textheight which could not be set in the preamble without being immediately overwritten. Interestingly, I discovered that when not in a frame, beamer will page break and move residual text to the next page (something it does not do inside a frame).

\documentclass{beamer}
\usepackage{everypage}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{fancyhdr}
\pagestyle{fancy}
% In beamer, these changes can be made in the preamble
\addtolength{\topmargin}{1pt}
\addtolength{\headsep}{5pt}
\addtolength{\oddsidemargin}{-4pt}
\addtolength{\marginparwidth}{20pt}
\addtolength{\marginparsep}{-3pt}
\addtolength{\textwidth}{-5pt}
%
\fancyhf{}
\fancyhead[C]{This is also a header test}
\fancyfoot[C]{This is also a footer test}
\AddEverypageHook{\hbox{\color{blue!40}\smash{\hspace{\oddsidemargin}%
  \rule[-\textheight-\headsep-\headheight-\topmargin]{\textwidth}{\textheight}%
}}}
\AddEverypageHook{\hbox{\color{blue!30}\smash{\hspace{\oddsidemargin}%
  \rule[-\headheight-\topmargin]{\textwidth}{\headheight}%
}}}
\AddEverypageHook{\hbox{\color{blue!20}\smash{\hspace{\oddsidemargin}%
  \rule[-\textheight-\headsep-\headheight-\topmargin-\footskip]{\textwidth}{\headheight}%
}}}
\AddEverypageHook{\hbox{\color{blue!10}\smash{\hspace{\oddsidemargin}%
  \hspace{\textwidth}\hspace{\marginparsep}%
  \rule[-\textheight-\headsep-\headheight-\topmargin]{\marginparwidth}{\textheight}%
}}}
\begin{document}
% In beamer, these changes have no effect in preamble
\addtolength{\textheight}{-40pt}
\addtolength{\headheight}{15pt}
\addtolength{\footskip}{15pt}
%
\begin{frame}{title of the slide}
\lipsum[3]
\end{frame}
\clearpage
\lipsum[3]\marginpar{this is a margin test}

\end{document}

This is a slide within a frame:

enter image description here

This is the next slide, not in a frame:

enter image description here

EDITED to account for the 2018.12.01 TeX kernel changes to \smash.

3
  • This is nice, and I think it adequately shows the different spaces, though not in quite the same way as showframes. I'll accept it for now unless anything better comes along.
    – cslstr
    May 10, 2014 at 2:47
  • where the heck is that text with the "Nulla malesuda.." comming from, how can i get rid off that ? May 22, 2020 at 12:43
  • @ΦXocę웃Пepeúpaツ That is the lipsum package and anything that says \lipsum is producing that text. May 22, 2020 at 13:02

You must log in to answer this question.

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