15

I want to reduce the white space (above and below) when I insert an equation environment in a beamer block.

\documentclass{beamer}
\usetheme{Antibes}
\usepackage{amsmath}

\begin{document}

\begin{frame}

\begin{block}{Separation of variables}
\setlength\abovedisplayskip{0pt}
\begin{equation}
1 + 2 = 3
\end{equation}
\end{block}

\end{frame}

\end{document}

enter image description here

I searched the web of course but the solutions I found do not seem to work (like \setlength\abovedisplayskip{0pt}).

What I found and should have worked:

1 Answers1

20

A displayed equation should never be at the top of anything. The problem is that a paragraph is started and then the equation is typeset.

\documentclass{beamer}
\usetheme{Antibes}
\usepackage{amsmath}

\begin{document}

\begin{frame}

\begin{block}{Separation of variables}
\vspace*{-\baselineskip}\setlength\belowdisplayshortskip{0pt}
\begin{equation}
1 + 2 = 3
\end{equation}
\end{block}

\begin{block}{Separation of variables}
Some text
\end{block}

\end{frame}

\end{document}

enter image description here

egreg
  • 1,121,712
  • @jotagah A block like the second one would be printed incorrectly. – egreg Apr 21 '14 at 12:37
  • We can also to use \addtobeamertemplate{block begin}{\vspace*{-\baselineskip}\setlength\belowdisplayshortskip{0pt}} ? – jotagah Apr 21 '14 at 13:01
  • Egreg, l understand now the picture. – jotagah Apr 21 '14 at 13:08
  • Worked like a charm. one before [ and one before ]...do you mind explaining difference between \vspace and \vspace* ? – Troy Woo May 28 '15 at 09:37
  • 1
    @TroyWoo \vspace* inserts a vertical space that's not removed at page breaks. In this case probably \vspace would be good as well. – egreg May 28 '15 at 09:42
  • Thanks for the explanation! I feel that somehow lack a systematic education of latex. I wonder how everyone else picked it up...by reading the tex book??! – Troy Woo May 28 '15 at 10:27
  • 1
    @TroyWoo There are many possible roads; a well written LaTeX guide is a good starting point. Look at http://www.dickimaw-books.com/latexresources.html – egreg May 28 '15 at 10:30