1

I've modified \item to insert a \vfill after each occurrence to space out bulleted lists on slides so they do not cluster in the center following this answer. However, to balance out my vertical spacing, I have to include a \vfill at the end of each slide.

\begin{frame}
    \begin{itemize}
        \item foo
        \item bar
        \item baz
    \end{itemize}
\end{frame}

I'd like to avoid this repeated effort by modifying the frame environment to automatically include a \vfill before the \end{frame}:

\begin{frame}
    \begin{itemize}
        \item foo
        \item bar
        \item baz
    \end{itemize}
\vfill % I want this automatically inserted
\end{frame}

Thus, I need to run a command before the end of each frame. The top answer to this question details how to use etoolbox to tap into the low level commands in beamerbaseframe.sty to add arbitrary TeX code to the end of each slide. However, I've tried modifying the provided code and it results in placing a test string after the frame environment ends, resulting in a blank slide after each slide with the test string at the top, or before, with a blank slide before each slide with the test string at the top. Needless to say since my test string is appearing on slides by itself, when I replace it with \vfill, my the items on my slides are not spaced out like they should be.

I don't understand beamerbaseframe.sty well enough to know which command I should be patching to achieve my desired outcome. Where should I be looking to patch to add a command directly before the end of every frame?

MWE with my attempt at solving this and demonstrating the spacing I'd like to achieve:

\documentclass{beamer}

\usepackage{etoolbox}

\makeatletter
\patchcmd{\beamer@doseveralframes}% <cmd>
{\beamer@reseteecodes}% <search>
{\beamer@reseteecodes\textbf{aaa}}% <replace>
{}{}% <success><failure>
\makeatother

\let\olditem\item
\renewcommand{\item}{%
    \olditem\vfill}

\begin{document}

\begin{frame}
    \begin{itemize}
        \item foo
        \item bar
        \item baz
    \end{itemize}
\end{frame}

\begin{frame} % this slide is spaced how I want
    \begin{itemize}
        \item foo
        \item bar
        \item baz
    \end{itemize}
\vfill
\end{frame}

\end{document}
  • Welcome! To me this seems like an XY question. You may really be looking for \begin{frame}[t], i.e. the t option makes the contents "move up" (as if there was a \vfill at the end). –  Sep 25 '19 at 22:03
  • This doesn't center it the way a \vfill at the end does, probably because each \item is now followed by a \vfill. – jayrobwilliams Sep 25 '19 at 22:31
  • Some good soul pinged me and is wondering if you are looking for https://tex.stackexchange.com/a/369597/194703, then. –  Sep 25 '19 at 22:59
  • This does exactly what I want, thank you! It even spreads out items slightly more fully than my previous approach. – jayrobwilliams Sep 26 '19 at 01:01

0 Answers0