Inspired by a recent question with a very similar sounding title, I would actually love to implement auto-magic vertical stretch for beamer slides (where, maybe unlike full documents, I think makes a lot of sense!).
I've been very interested in controlling the vertical spacing on items in a slide for a long time (to me the default looks too “cramped”), and following ideas such as these, I've also implemented some hacks to manually control the vertical spacing on a slide using only an option such as [wide=10pt]
on the frame. This is better than manually peppering my slides with \medskip
and \bigskip
s, and it kind of works, but not all the time (see below).
What I would love, however, is to have all of these done automatically for me, without having to manually tune the required amount of spacing on each slide. So, following the advice on the question from that first link, I came up with something that almost works, but still has plenty deficiencies.
For testing I'm using a document that looks like:
\documentclass{beamer}
\newcommand{\addstretch}[1]{\addtolength{#1}{\fill}}
\newcommand\stretchy{\only<2>{%
% \addstretch{\baselineskip}% Doesn't look very nice
\addstretch{\abovedisplayskip}%
\addstretch{\abovedisplayshortskip}%
\addstretch{\belowdisplayskip}%
\addstretch{\belowdisplayshortskip}%
\addstretch{\parskip}%
}}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{A few paragraphs (with\only<1>{out} stretching)}
\stretchy
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of the things in themselves.
I have shown elsewhere, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what first give rise to the architectonic of practical reason.
\end{frame}
...
And the first few pages look like:
The full source is here and an annotated version of the generated pdf is here.
This approach, just like my previous hack, has several problems:
- Spacing around
equation
orcenter
environments doesn't seem to be consistent with other spaces between paragraphs. Also, to me, it's kind of hard to figure out which lengths are the ones responsible for the extra space that I often get, having to resort, again, to manual hacks trying to “kill” the extra space. - Beamer makes it very difficult to consistently modify spaces within different environments. Notoriously,
itemize
andcolumns
environments reset those spacings, so nasty hacks are needed to pass spacing options, e.g., from a frame to an itemize. Sometimes I can make them work for specific combinations, but often in the future I'm prone to find more combinations which I hand't considered and break my desired spacing rules. - Nested subitems are particularly problematic, just setting the same spacing rules at the beginning of each itemize block makes some of the spaces too big.
- In general, interactions between
itemize
,equation
, andcenter
environments produce—at least to me—somewhat unpredictable results. - Stretching in a
columns
environment doesn't work at all.
Ideally what I would like is to simply have to say:
\begin{frame}[stretch]
... frame contents ...
\end{frame}
and then have all the contents in the frame nicely vertically stretched and filling up all the space in the slide, with minimum or no manual modifications on the slide content. Do you think we could implement something like that?