# Forcing beamer blocks to be the same height — interaction with figures?

I am trying to make a beamer poster. I am organizing the poster in columns. In two of the columns, I would like to align some blocks half-way down the page. My current approach to this is to try to force the blocks above them to be the same height, although I am open to other suggestions. I am inserting \vboxs inside the blocks to try to set their height. This works to some extent, but is interacting with vertical padding and leads to different effective heights depending on whether the block contains text or a figure. What is the best way to get the second row of blocks to be vertically aligned?

Here is my not quite minimal example

\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{subcaption}
\usepackage{lipsum}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}

% Make the figure caption labels bold
%\setbeamerfont{caption}{series=\bfseries}
% Beamer disables figure numbering by default (it assumes figure numbers on
% slides would not make sense). This command restores autonubering
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption name}{series=\bfseries}
\setbeamertemplate{caption label separator}[period]

\begin{document}

% beamer has a problem filling vertical space in colums
% have to manually specify column heights
%
\newlength{\colheightb}
\setlength{\colheightb}{0.8775\paperheight}

% beamer can't really vertically align blocks properly
% Workaround is to do manual alignment
%
\newlength{\blockheight}
\setlength{\blockheight}{23cm}

% Latex places too much space beneath figure captions.
% This variable makes an adjustment
\setlength{\belowcaptionskip}{-0.5ex}

% I want the scatter plots to be exactly the same size
\newlength{\scatterwidth}
\setlength{\scatterwidth}{30cm}

% There was too much space between the title and the blocks, this was the patch
\newlength{\yfudge}
\setlength{\yfudge}{-0.85cm}

\begin{frame}{}
\begin{columns}[T, totalwidth=\textwidth]

\begin{column}{.49\linewidth}
\vspace{\yfudge}
\vbox to \colheightb{%
\begin{block}{Section}
\vbox to \blockheight{
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
}
\end{block}

\begin{block}{Section}
\end{block}
\vfill
}
\end{column}

\begin{column}{.49\linewidth}
\vspace{\yfudge}
\vbox to \colheightb{%
\begin{block}{Section}
\vbox to \blockheight{

\begin{figure}[H]
\vspace{10ex}
\caption{The block contianing a figure is not the correct height!}
\end{figure}
}
\end{block}

\begin{block}{Section}
{
}
\end{block}
\vfill
}
\end{column}

\end{columns}
\end{frame}
\end{document}


And here is the style document

\usepackage{grffile}
\usepackage{calc}
\usepackage{tcolorbox}
\usepackage{lmodern}

\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{frametitle}[default][center]
\AtBeginDocument{%
{
}
{%
color(0cm)=(bg);
}
}
\beamertemplatedotitem
\mode
<all>

\setbeamercolor{block body}{bg=white,fg=black}
\setbeamercolor{block title}{bg=black,fg=white}

\leavevmode
\vskip1cm
\raggedright
\color{fg}{\fontsize{110}{110}\selectfont {\inserttitle}}\\[3ex]}
\color{fg}\LARGE{\insertauthor}\\[1ex]}
\color{fg}\large{\insertinstitute}\\[1ex]}
\vskip2ex
\end{beamercolorbox}
\rule{0pt}{3pt}
\end{beamercolorbox}
}
% no navigation on a poster

% Use rounded blocks
%\setbeamertemplate{blocks}[rounded]

% Larger titles for the block
\makeatletter
\newcommand\semiHuge{\@setfontsize\semiHuge{45}{40}}
\makeatother
\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\semiHuge}


Edit: Update: I was able to finish my poster by manually adjusting the block heights until they approximately matched. This is not a solution, but it will have to do.

## Edit: stacking column environments doesn't work as needed

It was suggested that proper vertical alignment could be achieved by stacking two column environments. This works if there are only two columns, but my use case is more complex, which wasn't reflected in the previous minimal example. I have created a new minimal example illustrating why the column alignment approach isn't suitable here, as it would require nesting column environments which creates new vertical alignment issues at the top.

\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{subcaption}
\usepackage{lipsum}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}

% Make the figure caption labels bold
%\setbeamerfont{caption}{series=\bfseries}
% Beamer disables figure numbering by default (it assumes figure numbers on
% slides would not make sense). This command restores autonubering
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption name}{series=\bfseries}
\setbeamertemplate{caption label separator}[period]

\begin{document}

% beamer has a problem filling vertical space in colums
% have to manually specify column heights
%
\newlength{\colheightb}
\setlength{\colheightb}{0.7\paperheight}

% beamer can't really vertically align blocks properly
% Workaround is to do manual alignment
%
\newlength{\blockheight}
\setlength{\blockheight}{10cm}

% Latex places too much space beneath figure captions.
% This variable makes an adjustment
\setlength{\belowcaptionskip}{-0.5ex}

% There was too much space between the title and the blocks, this was the patch
\newlength{\yfudge}
\setlength{\yfudge}{-0.85cm}

\begin{frame}{}
\begin{columns}[T, totalwidth=\textwidth]

\begin{column}{.32\linewidth}
\vbox to \colheightb{%
\begin{block}{Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{block}
\vfill

\begin{block}{Section}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{block}
}
\end{column}

\begin{column}{.67\linewidth}
\vbox to \colheightb{%

\begin{columns}[t,totalwidth=\textwidth]
\begin{column}{.48\linewidth}
\begin{block}{Section}
\vbox to \blockheight{Different height, and vertical padding between is reduced?!}
\end{block}
\end{column}
\begin{column}{.48\linewidth}
\begin{block}{Section}
\begin{figure}[H]
\vbox to \blockheight{
\vspace{10ex}
\caption{The block contianing a figure is not the correct height!}}
\end{figure}
\end{block}
\end{column}
\end{columns}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.48\linewidth}
\begin{block}{Section}
\end{block}
\end{column}
\begin{column}{.48\linewidth}
\begin{block}{Section}
\end{block}
\end{column}
\end{columns}
\vfill

}
\end{column}

\end{columns}
\end{frame}
\end{document}

• Quick fix: add \strut before and after the text and the figure environment. That is, change to \strut\begin{figure}, \end{figure}\strut and \strut The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).\strut There's obviously some more elegant solution though. Also, be careful with spaces/newlines when using beamercolorbox – Grimler Oct 6 '15 at 9:15
• Hey that worked! I think it's a pretty good solution, no? What exactly does \strut do? Edit: actually, nope. It worked in my example but isn't working in my poster: \strut leaves some vertical misalignment. I'm not sure what the difference is. – MRule Oct 6 '15 at 17:19
• Update: so, \strut almost works, with some tweaking. I had to add a bunch of positive and negative \vspace commands to fix the padding and alignment of the content inside the boxes, but at the end of the day, the boxes were the same height, so that's good. Really what I want here is some sort of enhanced version of \vspace that can be placed between the boxes and can be told to enforce exact vertical alignment between neighboring columns. I'm going to leave the question as unsolved for now, just in case a more elegant solution pops up. – MRule Oct 6 '15 at 17:40
• \strut creates an invisible box with a certain height, it is taller than all (capital) letters and is used to make sure that the frametitle (and other objects) has the same vertical alignment (and doesn't vary depending on the size of the letters that happened to be used). Sounds like a good plan to leave it open! I'll give it another shot when I have time – Grimler Oct 6 '15 at 17:51

Here's a suggestion using minipages instead of the column environment. The good thing with minipages is that you can specify the height. The vertical alignment is done with \hfill.

The command is \begin{minipage}[alignment][HEIGHT][alignment]{WIDTH}...\end{minipage}

The text and figures seem to align fine now but please let me know if it doesn't work as you want it to.

I also created a new environment (called MRuleBlock) that might simplify your code. The code generates two slides, one without the new environment and one with.

Code:

\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
%\usepackage{subcaption}
\usepackage{lipsum}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}

\newlength{\blockheight}
\setlength{\blockheight}{.5\textheight}
\newlength{\blockwidth}
\setlength{\blockwidth}{.31\textwidth}

\newenvironment{MRuleBlock}[3]{%
\begin{minipage}[t][#2][t]{#3}%
\begin{block}{#1}%
}{%
\end{block}%
\end{minipage}%
}

% Make the figure caption labels bold
%\setbeamerfont{caption}{series=\bfseries}
% Beamer disables figure numbering by default (it assumes figure numbers on
% slides would not make sense). This command restores autonubering
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption name}{series=\bfseries}
\setbeamertemplate{caption label separator}[period]

\begin{document}
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}

\end{block}
\end{minipage}

\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
Different height, and vertical padding between is reduced?!
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
\begin{figure}[H]
\caption{The block containing a figure is the correct height!}
\end{figure}
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
\lipsum[1]
\end{block}
\end{minipage}

\newpage
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}

\end{MRuleBlock}

\begin{MRuleBlock}{Section}{}{\blockwidth}
Different height, and vertical padding between is reduced?!
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{}{\blockwidth}
\begin{figure}[H]
\caption{The block containing a figure is the correct height!}
\end{figure}
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{}{\blockwidth}
\lipsum[1]
\end{MRuleBlock}
\end{document}


Which gives:

You can obviously play around with the parameters \blockheight and \blockwidth to fine tune the blocks.

Would simply opening a new set of columns a solution for you?

\documentclass[t]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}

\begin{document}
\begin{frame}{}

\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\begin{column}{.49\linewidth}
\begin{block}{Section}
\begin{figure}[H]
\vspace{60ex}
\caption{The block contianing a figure is not the correct height!}
\end{figure}
\end{block}
\end{column}
\end{columns}

\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}


• In this case I suspect not, as I suspect it will interact badly with other parts of my layout. One minute, I will check and update the minimal example if this is not viable. – MRule Oct 6 '15 at 16:43
• Update: I have created a new example. In my use case I think this approach would require nesting column environments, which creates vertical alignment issues at the top and makes it hard (impossible?) to get the horizontal padding between columns equal. – MRule Oct 6 '15 at 17:02