3

I am trying to get rid of the spacing around gather/align environments in a Beamer presentation. As usual, I set the abovedisplayskip & friends registers to zero with \g@addto@macro\normalsize. This works great (uncomment lua-visual-debug to show the debug lines in LuaLaTeX):

\documentclass[xcolor=dvipsnames,compress,9pt]{beamer}
\usepackage{amsmath}
%\usepackage{lua-visual-debug}

\mode<presentation>
\usenavigationsymbolstemplate{}

\setlength{\parskip}{0.2cm plus 1fill}
\global\parskip=\parskip
\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{0cm plus 0cm minus 0cm}
  \setlength\belowdisplayskip{0cm plus 0cm minus 0cm}
  \setlength\abovedisplayshortskip{0cm plus 0cm minus 0cm}
  \setlength\belowdisplayshortskip{0cm plus 0cm minus 0cm}
}

\define@key{beamerframe}{c}[true]{% centered
    \beamer@frametopskip=0pt plus 1fill
    \beamer@framebottomskip=0pt plus 1fill%
    \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
    \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
    \def\beamer@initfirstlineunskip{}%
}
\makeatother

\begin{document}
\begin{frame}
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
 elit,
    vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\par
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\par
\begin{gather*}
x^2+y^2=z^2
\end{gather*}
\par
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\end{frame}
\end{document}

So far so good!

Unexpectedly, additional space is introduced if I set the math text Beamer color:

\documentclass[xcolor=dvipsnames,compress,9pt]{beamer}
\usepackage{amsmath}
%\usepackage{lua-visual-debug}

\mode<presentation>
\usenavigationsymbolstemplate{}

\setlength{\parskip}{0.2cm plus 1fill}
\global\parskip=\parskip
\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{0cm plus 0cm minus 0cm}
  \setlength\belowdisplayskip{0cm plus 0cm minus 0cm}
  \setlength\abovedisplayshortskip{0cm plus 0cm minus 0cm}
  \setlength\belowdisplayshortskip{0cm plus 0cm minus 0cm}
}

\define@key{beamerframe}{c}[true]{% centered
    \beamer@frametopskip=0pt plus 1fill
    \beamer@framebottomskip=0pt plus 1fill%
    \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
    \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
    \def\beamer@initfirstlineunskip{}%
}
\makeatother
\setbeamercolor{math text}{fg=red} %%% HERE!

\begin{document}
\begin{frame}
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
 elit,
    vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\par
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\par
\begin{gather*}
x^2+y^2=z^2
\end{gather*}
\par
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris.
\end{frame}
\end{document}

Is there any way I can use the math text feature without losing my beloved spacing configuration? My guess is that, when starting math mode, Beagle's template for math formatting is triggered and the values of abovedisplayskip & friends are reseted.

  • 1
    I don't understand why you reset the skip via normalsize. If you want them to be zero, then why not globally? Beside this the problem is the grouping from the color along with the \par you are using before and after the gather. – Ulrike Fischer May 14 '16 at 15:49
  • 1
    related: bitbucket.org/rivanvx/beamer/issues/177/… – user36296 May 14 '16 at 16:19
  • @UlrikeFischer I tried via \global\abovedisplayskip=0pt and so on, with the same results. Regarding the \pars, I actually want equations as standalone paragraphs. Any idea how could I redefine the displayskips after the color has been set? – Jaeya May 15 '16 at 13:06
  • @samcarter yes, that sounds as essentially the same problem. Still, it is suggested in that thread that this is an intended feature in Beamer. – Jaeya May 15 '16 at 13:07
  • link to the above mentioned issue changed to github.com/josephwright/beamer/issues/177 – user36296 Jan 2 at 13:21

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.