2

Even though similar questions arose here and there, I cannot find a satisfying answer to my problem. I am trying to have consistent/identical vertical spacing between text, equations and lists in beamer. More exactly, I am looking at the vertical spacing between:

  1. text followed by equation (and vice versa)
  2. equation followed by a list

While the spaces in point 1. are perfectly fine, I have trouble understanding what happens in point 2. : an equation followed by a list produces a too large space, and a list followed by an equation produces a too small space. A MWE can be found below.

What I would like to do is to fix this once and for all in the preamble, and not having to add some code manually every time there is an interaction between those two environments. But I see no obvious parameters to change :

  • playing with the parameters \abovedisplayskip \belowdisplayskip will solve the problem for point 2. but will mess up the spacing for point 1. And I do not want to do that "locally".
  • Adding some (negative) vertical space \vspace{-\baselineskip} before every list will mess up the spacing wetween lists and text.

I feel like here both equation and itemize environements are set to to add some vertical spacing around them, and that these spaces cumulate when next to each other. Maybe I am wrong but I remember reading once that in TeX there is a concept of "conditional space", meaning a space which needs to be inserted but to the condition that the resulting space (after combination with other commands) will not be larger than a given threshold. Could it be what I need?

Any help would be highly appreciated. Here is a MWE :

\documentclass{beamer}

\begin{document}

\begin{frame}{What I'm satisfied with}
Here is an equation, surrounded by two sentences.
\begin{equation*}
e^x \Vert \nabla f(x) \Vert \leq f(x^k) - \inf f
\end{equation*}
We see that the spacing above and below is the same.

\bigskip \hrule \bigskip

Now we look at equations inside a list.
\begin{itemize}
    \item Some text in the first item.
    \begin{equation*}
        e^x \Vert \nabla f(x) \Vert \leq f(x^k) - \inf f
    \end{equation*}
    Some more text, still in the first item. Good spacing.
    \item Some text in the second item.
    \begin{equation*}
        e^x \Vert \nabla f(x) \Vert \leq f(x^k) - \inf f
    \end{equation*}
    \item Some text in the third item. Good spacing.
\end{itemize}
\end{frame}

\begin{frame}{What I'm not satisfied with}
Now an equation followed by a list.
\begin{equation*}
e^x \Vert \nabla f(x) \Vert \leq f(x^k) - \inf f
\end{equation*}
\begin{itemize}
    \item We see a superfluous space between the equation and the list.
\end{itemize}

\bigskip \hrule \bigskip

Now an equation preceded by a list.
\begin{itemize}
    \item Here is an itemize environment, with one item.
\end{itemize}
\begin{equation*}
e^x \Vert \nabla f(x) \Vert \leq f(x^k) - \inf f
\end{equation*}
The space above and below is roughly the same, but it is a smaller spacing than in the first examples.
\end{frame}

\end{document}

what i'm satisfied with

what i'm not satisfied with

2
  • This would require me to change my lists everywhere manually, which is what I am trying to avoid.
    – Guillaume
    Sep 16, 2021 at 9:12
  • Changing all the lists is not an option since the spacing issue holds only when they are surrounded with equations. Moreover, I do not want in the future to have to specify an option for every list I type. It is a much more desirable solution to fix once and for all the behavior of lists in the preamble.
    – Guillaume
    Sep 16, 2021 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.