# How to line up blocks in columns with full width blocks in beamer/beamerposter?

This input to pdflatex (whatever version of texlive is on Debian/squeeze)

\documentclass{beamer}

\usepackage[orientation=portrait,size=a3,scale=0.9]{beamerposter}
\usepackage{lipsum}

\beamertemplategridbackground[0.5cm]

\setbeamercolor*{block body}{bg=white,fg=black}
\setbeamercolor*{block title}{fg=white,bg=blue}
\setbeamerfont{block title}{size=\Large}

\begin{document}

\begin{frame}

\begin{block}{Introduction}
\lipsum[1]
\end{block}

\begin{columns}[t]

\begin{column}{.5\textwidth}
\begin{block}{Problems are inevitable}
\lipsum[2]
\end{block}
\end{column}

\begin{column}{.5\textwidth}
\begin{block}{Problems are soluble}
\lipsum[3]
\end{block}
\end{column}

\end{columns}

\begin{block}{Conclusion}
\lipsum[4]
\end{block}

\vfill

\end{frame}

\end{document}


produces this output:

Now obviously putting 0.5\textwidth (or 0.5\linewidth) for each column is going to be too wide because it doesn't take account of any column spacing or margins, so it's not surprising it doesn't line up nicely with the non-column full width blocks above and below. However, it's not clear to me what I could/should specify there to achieve that result.

My current workround is to just fiddle around with the widths until it looks good enough (the grid helps), but there must be a better way.

My question is, what should I put for the column widths which will magically make the outer edges of the column blocks be in harmonious agreement with full-width non column blocks ? Is there something which can be calculated from other beamer parameters which will just work ?

Update 2012-10-06: Looked a bit more into this. Comments on this question and the answer here make me think a satisfactory solution will need a new columns environment defining, or the beamer one modifying somehow.

-

The columns environment can take quite a few optional arguments, one of which is totalwidth which I have specified as \linewidth in the solution below.

Here's the output

I've borrowed Stefan's solution from Changing default width of blocks in beamer to define a varwidth block which allows you to specify the width of a block environment.

It does lead to an overfull hbox so perhaps this solution isn't ideal; if someone can improve on it I'll delete this answer. If your presentation is tomorrow, then this will work :)

\documentclass{beamer}

\usepackage[orientation=portrait,size=a3,scale=0.9]{beamerposter}
\usepackage{lipsum}

\beamertemplategridbackground[0.5cm]

\setbeamercolor*{block body}{bg=white,fg=black}
\setbeamercolor*{block title}{fg=white,bg=blue}
\setbeamerfont{block title}{size=\Large}

\newenvironment<>{varblock}[2][.9\textwidth]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}

\begin{document}

\begin{frame}

\begin{block}{Introduction}
\lipsum[1]
\end{block}

\begin{columns}[t,totalwidth=\linewidth]
\begin{column}{.5\linewidth}
\begin{varblock}{Problems are inevitable}
\lipsum[2]
\end{varblock}
\end{column}
\begin{column}{.5\linewidth}
\begin{varblock}[\textwidth]{Problems are soluble}
\lipsum[3]
\end{varblock}
\end{column}
\end{columns}

\begin{block}{Conclusion}
\lipsum[4]
\end{block}

\vfill

\end{frame}
\end{document}

-
This is a bit fiddly, but presentations and posters usually are- if this is no good then please let me know :) –  cmhughes Oct 1 '12 at 0:55
This looks promising (and certainly well within acceptable levels of fiddliness!)... there's one fatal problem though: the right block is wider than the left one. I just measured it just to be sure it's not some optical illusion. (No rush... my poster is already done as a single column of wide blocks containing multicol, but this issue came up during the production and I'd really like to know how to do this sort of layout easily). –  timday Oct 1 '12 at 8:10
Ah I see the different widths arise simply from the first varbox being varbox's default 0.9\textwidth and the other one being \textwidth. However, all my attempts to mess with this source result in the right block's right edge no longer lining up nicely. Perplexing. –  timday Oct 1 '12 at 9:13
@timday a bit of a hack, but you could leave the second varblock having \textwidth and then try cranking up the first one to .95\textwidth or higher if you'd prefer... I wish I had a cleaner solution though :) –  cmhughes Oct 1 '12 at 15:29