4

While making a poster, I've got two columns with blocks with itemize inside them. MWE:

\documentclass[final]{beamer}
\mode<presentation>{}

\usepackage{times}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}

\begin{document}
\begin{frame}[t]{} 

%\leavevmode
\begin{columns}[t, onlytextwidth]
\begin{column}{.5\linewidth}
\begin{block}{Contributions}
\begin{itemize}
\item First Item
\item Second Item
\end{itemize}
\end{block}
\end{column}
\begin{column}{.5\linewidth}
\begin{block}{Approach}
\begin{itemize}
\item First Item
\item Second Item
\end{itemize}
\end{block}
\end{column}
\end{columns}

\end{frame}
\end{document}

My local installation and ShareLaTeX would misalign the bullets(baselines added by me): bug illustration

This problem seems similar to:

But this time it happens when itemize is inside the block. If one removes the blocks it works fine.

Am I missing something or does it look like a Beamer bug?

Thanks! I'm a LaTeX noob, sorry if I missed something stupid.

2 Answers2

2

In your example, the depth of the first title is null (no letter as g or y). To work around this feature (or "bug") of beamer, you may add \vphantom{Ag} in each title of your blocks (\vphantom adds a vertical phantom of its content).

\documentclass{beamer}
\usepackage{times}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}

\begin{document}
\begin{frame}[t]{} 
  \begin{columns}[t, onlytextwidth]
    \begin{column}{.45\linewidth}
      \begin{block}{Contributions\vphantom{Ag}}
        \begin{itemize}
        \item First Item
        \item Second Item
        \end{itemize}
      \end{block}
    \end{column}
    \begin{column}{.45\linewidth}
      \begin{block}{Approach\vphantom{Ag}}
        \begin{itemize}
        \item First Item
        \item Second Item
        \end{itemize}
      \end{block}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

Note: if you use onlytextwidth, the sum of the width of your columns should be lesser than \textwidth (to get a space between your columns).

Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
1

In case one prefers a tighter vertical spacing, the following answer ignores the descending parts of the letters:

\documentclass{beamer}

\setbeamercolor{block title}{bg=red!30,fg=black}

\setbeamertemplate{block begin}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title}
    \usebeamerfont*{block title}\strut\insertblocktitle\vskip-\dp\strutbox%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\begin{document}

\begin{frame}
\begin{block}{This title has a problem}
    some text
\end{block}
\begin{block}{This title is about fine}
    some text
\end{block}
\end{frame}

\end{document}

enter image description here

  • It it possible to achieve a vertically centered layout (considering only the baseline and cap height)? Assuming that \dp\strutbox is equivalent to 0.3\baselineskip, I think that something between 0.2\baselineskip and 0.25\baselineskip would look best, but unfortunately the result seems to depend on the font... – Jakub Klinkovský Jul 06 '17 at 15:48
  • @JakubKlinkovský Isn't this vertically centred? If I measure the space below and above the T are equal. – samcarter_is_at_topanswers.xyz Jul 06 '17 at 15:52
  • @JakubKlinkovský In any case, if you find \vskip-\dp\strutbox too much try with \vskip-.66\dp\strutbox or whatever you like. – samcarter_is_at_topanswers.xyz Jul 06 '17 at 15:54
  • In the posted image, there is 10px of red above the T, but only 8px below it. I think that I've already found the ideal dimension for the fonts in my current project, but obviously it would be great to have a solution guaranteed to not depend on any particular font. – Jakub Klinkovský Jul 06 '17 at 16:06