2

Update

There is already a solution in @mickep's comment, which is \noindent. I am waiting for an answer from them that I can accept or I will soon write one myself that contains their solution. Thank you all!

Original post

In our insitute's Beamer template, top-aligned frames are preferred. When I start the frame with an equation, there is space left for one line of text, which I can only remove using \vspace*{-SomeSpace}. Is there a frame or class option that prevents the inclusion of this empty line of text? Thanks.

MWE:

\documentclass[t]{beamer}

\begin{document}

\begin{frame}{Frametitle 1}
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

\begin{frame}{Frametitle 2}
Hey, here is some text.
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

\end{document}

If you move back and forth between the two slides in presentation mode of your PDF viewer, you see that there is space for some phantom text on the first slide.

2
  • 2
    I have not tested, but it sounds like indentation. Does \noindent help?
    – mickep
    Jan 14 at 9:28
  • @mickep It does, thank you. Would you care to write an answer that I can accept? Btw I am very confused about the terminology now, why this would be considered indentation when it's about vertical spacing.
    – drumath
    Jan 14 at 10:10

3 Answers 3

3

The solution will not be found within beamer.

The equation* is defined by amsmath and the space above can be controlled redefining \abovedisplayshortskip , which is used when the line above is "short".

Of course, this will apply to all equation environments.

a

\documentclass[t]{beamer}

%****************** added <<<<<<<<<<
\usepackage{xpatch}
\xapptocmd{\normalsize}{\abovedisplayshortskip=-\the\baselineskip}{}{}
%*******************************

\begin{document}
    
    \begin{frame}{Frametitle 1}
        \begin{equation*}
            aa = bb
        \end{equation*}
    \end{frame}
    
    \begin{frame}{Frametitle 2}
        Hey, here is some text. 
        
        \begin{equation*}
            aa = bb
        \end{equation*}
    \end{frame}
    
\end{document}

For the meaning of "short" see abovedisplayskip vs abovedisplayshortskip

5
  • I think the OP is looking for a solution that eliminates the whitespace padding only for those displayed equations -- whether numbered or unnumbered -- that occur at the very beginning of a frame. The whitespace padding above other displayed equations should not be changed, right?
    – Mico
    Jan 14 at 20:35
  • 1
    Only when the line above is "short". See the second frame. Jan 14 at 20:38
  • The link you provided doesn't appear to work properly; please fix. More importantly, the solution approach you've provided generates a poor typographic result if the paragraph (which could be a one-line paragraph) that precedes the equation* environment does not end in a "short" line. E.g., check what happens if you replace "Hey, here is some text." in frame 2 with "Hey, here is some text. Hey, here is some text." -- the amount of vertical spacing between the text and the displayed equation is simply inadequate.
    – Mico
    Jan 14 at 20:52
  • @SimonDispa thank you for taking the time to answer my question! I didn't know about abovedisplayshortskip but it has the downside of what @Mico says. I only wanted to remove the extra space at the top of a slide that starts with an equation. I think @mickep's answer is correct but they do not seem to need the extra reputation :)
    – drumath
    Jan 15 at 3:45
  • 1
    @drumath Thank you for your feedback! It certainly seems that \noindent works. You might add to add a full answer to your question, with due acknowledgment, for the benefit of other readers. Jan 15 at 16:06
2

I will add @mickep's comment (below the original post) as an answer because I find it the best.

I have not tested, but it sounds like indentation. Does \noindent help?

The solution is to add \noindent to the beginning of the slide that should start with an equation.

Updated MWE from the OP:

\documentclass[t]{beamer}

\begin{document}

\begin{frame}{Frametitle 1}
\noindent
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

\begin{frame}{Frametitle 2}
Hey, here is some text.
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

\end{document}

@SimonDispa's answer and @Sebastiano's answer also work but are not as nice as @mickep's in my opinion.

1

When I start the frame with an equation, there is space left for one line of text ... Is there a frame or class option that prevents the inclusion of this empty line of text?

Seriously, what do you think you're accomplishing -- in terms of providing reasonably digestible information to the audience of your beamer-based talk -- if you start the contents of a frame with a displayed equation? Do you maybe secretly detest the audience?

I'm afraid I know of no class or frame option that accomplishes your formatting objective. A non-kludgy hands-on way to accomplish your objective is to encase the contents of the frame in a minipage environment. E.g., you could replace

\documentclass[t]{beamer}
\begin{document}
\begin{frame}{Frametitle 1}
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

with

\documentclass[t]{beamer}
\begin{document}
\begin{frame}{Frametitle 1}
\begin{minipage}{\textwidth}
\begin{equation*}
    aa = bb
\end{equation*}
\end{minipage}
\end{frame}

enter image description here

\documentclass[t]{beamer}

\begin{document}
\begin{frame}{Frametitle 1 -- no embedded minipage}
\begin{equation*}
    aa = bb
\end{equation*}
\end{frame}

\begin{frame}{Frametitle 2 -- with embedded minipage}
\begin{minipage}{\textwidth}
\begin{equation*}
    aa = bb
\end{equation*}
\end{minipage}
\end{frame}

\end{document}
5
  • @downvoter what is the reason of the downvote. Write and identify yourself and don't hide you.
    – Sebastiano
    Jan 14 at 19:42
  • 1
    "Seriously, what do you think you're accomplishing ..." - I am sorry for all the stress in your life. When life is too much, I often do a breathing exercise; it helps me release tension. Let me know if you would like to talk to someone. Your style of communication is unacceptable and childish.
    – drumath
    Jan 15 at 3:40
  • 1
    Answer to the remaining part of your answer: thanks to you too for taking the time. minipage seems to be a good solution to my problem here but then @mickep's is much easier. I will either wait for them to write an answer or write one myself that contains that solution. I will edit the question to show this status
    – drumath
    Jan 15 at 3:49
  • (and I was not the downvote)
    – drumath
    Jan 15 at 3:50
  • @drumath You not know the story. I have a story of abuse of a user.
    – Sebastiano
    Jan 15 at 11:51

You must log in to answer this question.

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