5

I would like to place, in some frames, a text, on the bottom right of a beamer slide. I created a command which places this text by \vfill\hfill. In a normal class (as article), it works perfectly. But with beamer, the \vfill does not seem to have the standard behavior.

Compare the frame 1 and 2 in the following MWE

\documentclass[handout]{beamer}

\def\position#1#2{\vfill\hfill #1-#2}
\begin{document}

\begin{frame}
\begin{itemize}\item a
\item a
\item a
\end{itemize}
\position{2}{2}
\end{frame}

\begin{frame}
\begin{itemize}\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\end{itemize}
\position{2}{2}
\end{frame}
\end{document}

Any idea?

  • beamer uses \vfill at both ends to vertically center the frame contents. – egreg Nov 10 '14 at 18:02
  • Do you want to place the text specified by \position in the lower right corner of the frame? Then \vfill\hfill is certainly not the best way even for article. – egreg Nov 10 '14 at 18:08
  • why? what should be the best way? – Maïeul Nov 10 '14 at 18:09
  • in many case I want to put i the the lower right corner, but in some time, I want to put it between some other texte, so the \vill is perfect in my case. – Maïeul Nov 10 '14 at 18:10
  • @Maïeul , I am not sure what you are trying to do exactly but if you want your text to have exactly the same position from a slide to another, maybe you can try the eso-pic package ? – Alain Nov 10 '14 at 18:13
3

I will agree with @egreg that this does not seem to be the right way to do what you intend. In any case, if you insist, here's what I suggest.

Beamer uses \vfill to vertically justify your slide. You may think of it this way: there's a \vfill above your slide's contents and one more below them. So, roughly speaking, the \vfill that you introduce only uses one third of the slide's vertical unused space.

To use all of that space, you need the next level of TeX's glue stretching:

\def\position#1#2{\vskip 0pt plus 1filll\hfill #1-#2}

This will leave you with no space at the top or the bottom of your slide, but it may be what you were looking for.

  • yes, it's working in many case, except when my slide is too big (but that implies I should change my slide). – Maïeul Nov 10 '14 at 19:56
  • thanks a lot. But I am still thinking that is linked to a none standard behavior of beamer. – Maïeul Nov 10 '14 at 19:58
4

According to the beamer manual you can use the textpos package to position things absolutely on a page:

12.8 Positioning Text and Graphics Absolutely

Normally, beamer uses TEX’s normal typesetting mechanism to position text and graphics on the page. In certain situation you may instead wish a certain text or graphic to appear at a page position that is specified absolutely. This means that the position is specified relative to the upper left corner of the slide. The package textpos provides several commands for positioning text absolutely and it works together with beamer. When using this package, you will typically have to specify the options overlay and perhaps absolute.

enter image description here

Code:

\documentclass[handout]{beamer}

\usepackage[absolute,overlay]{textpos}

\newcommand*{\XOffsetFromBottomRight}{-2.0em}%
\newcommand*{\YOffsetFromBottomRight}{2.0ex}%
\newcommand*{\BottomRightText}[2]{%
    \par%
    \begin{textblock*}{5.0cm}(\dimexpr\textwidth-\XOffsetFromBottomRight\relax,\dimexpr\textheight-\YOffsetFromBottomRight\relax)
        #1-#2%
    \end{textblock*}%
}%

\begin{document}
\begin{frame}
\begin{itemize}\item a
\item a
\item a
\end{itemize}
\BottomRightText{2}{1}
\end{frame}

\begin{frame}
\begin{itemize}\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\item a
\end{itemize}
\BottomRightText{2}{2}
\end{frame}
\end{document}
  • many thank. I have opted for the @nickie solution, but your solution works too. – Maïeul Nov 11 '14 at 14:57
2
\vspace{\stretch{100}}    

(i.e. \vfill (top part if slide) \vfill\vfill...\vfill (bottom part) \vfill)

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    Can you explain what this code does? What are the advantages to the both given answers? Only code writing without explaining is not very clear ... – Mensch Sep 22 '15 at 16:33
  • 1
    Welcome to TeX.SX! It's not really clear where one should put this code – egreg Sep 22 '15 at 17: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.