# Right margin/padding in Beamer columns environment is wrong

I'm trying to make a poster in Beamer. The padding for multiple-column environments is wrong: the left side of the multiple columns is correctly aligned, but the right side adds extra padding. See below:

This question may be related, but the solution doesn't seem to do anything useful in this case. I've also looked at this solution to no avail. This question seems related, and gets partway to an answer, but doesn't explain the spurious right margin. It's not an issue with right-padding inside blocks, as the problem occurs even if the columns are simply introduced into the frame environment.

Here is a reduced example

\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A4,debug]{beamerposter}
\usetheme{Singapore4}

% Enable T1 (more modern) fonts
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}

\usepackage{grffile}
\usepackage{ragged2e}
\usepackage{amsmath,amsthm, amssymb, latexsym}

\title[]{Title}
\author[]{Authors}
\date{}
\institute[]{Institute}

\begin{document}

\setlength\columnsep{0pt}

\begin{frame}{}

\begin{block}{}
I've placed hrules in the columns to show that the spacing error comes from the column environment and not the block environment.\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\vspace{5em}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{block}

The problem is not related to Beamer blocks as "naked" columns show the same issue:\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}

\end{frame}
\end{document}


And here is the source code for my style file

% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%

\usepackage{grffile}
\usepackage{hyperref}
\usepackage{calc}
\usepackage{tcolorbox}
\usepackage{lmodern}% http://ctan.org/pkg/lm

%\ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/themes/theme/beamerthemeSingapore.sty,v d02a7cf4d8ae 2010/06/17 09:11:41 rivanvx$
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{frametitle}[default][center]
\AtBeginDocument{%
{
}
{%
color(0cm)=(bg);
}
}
\beamertemplatedotitem
\mode
<all>

% Template from T has special colors
\definecolor{TYellow}{RGB}{234,230, 99}
\definecolor{TBlue}{RGB}{ 29, 23, 96}
\definecolor{TAzure}{RGB}{151,147,204}
\definecolor{TWhite}{RGB}{255,255,255}
\definecolor{TPale}{RGB}{232,229,177}
\definecolor{VABlue}{RGB}{25,73,128}
\definecolor{RUST}{HTML}{EB7A59}
\definecolor{AZURE}{HTML}{5AA0DF}
\definecolor{OCHRE}{HTML}{EEA300}
\definecolor{TURQUOISE}{HTML}{00BAC9}
\definecolor{BLACK}{HTML}{44525C}
\definecolor{WHITE}{HTML}{F1F0E9}

% Configure the colors for the headline
\setbeamercolor{logobox}{bg=BLACK}
\setbeamercolor{block title}{bg=white,fg=VABlue}
\setbeamercolor{block body}{bg=WHITE,fg=black}
\setbeamercolor{block title}{bg=BLACK,fg=TWhite}

% define a new register to hold an intermediate size calculation
% that we'll use in defining the headline
\newlength{\residual}

\leavevmode

\setlength{\residual}{\paperwidth-20cm}

\begin{columns}[c]
\begin{column}{1cm}
\end{column}

\begin{column}[b]{9cm}
\end{column}

\begin{column}{\residual}
\vskip1cm
\centering
\color{fg}{\Huge\selectfont {\inserttitle}}\\[3ex]}
\color{fg}\Large{\insertauthor}\\[1ex]}
\color{fg}\large{\insertinstitute}\\[1ex]}
\end{column}

\begin{column}[t]{9cm}
\end{column}

\begin{column}{1cm}
\end{column}
\end{columns}
\vskip2ex
\end{beamercolorbox}

\rule{0pt}{3pt}
\end{beamercolorbox}
}

% Alignment grid
%\beamertemplategridbackground[1cm]

% no navigation on a poster

% 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]

\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\large}


The desired behavior is that the left and right margins of a multiple-column environment should be identical. Any thoughts?

A more minimal MWE - Observe what happens when \setbeamercolor{block body}{bg=gray,fg=black} is removed.

\documentclass{beamer}
\setbeamercolor{block body}{bg=gray,fg=black}

\begin{document}

\begin{frame}{}

\hrulefill

\begin{columns}[T,onlytextwidth]
\begin{column}{.4\textwidth}
\hrulefill
\begin{block}{test}
test
\end{block}
\end{column}
\begin{column}{.4\textwidth}
\hrulefill
\begin{block}{test}
test
\end{block}
\end{column}
\end{columns}

\vskip1cm
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.4\textwidth}
\hrulefill
\end{column}
\begin{column}{.4\textwidth}
\hrulefill
\end{column}
\end{columns}

\end{frame}
\end{document}

• Workaround: tex.stackexchange.com/a/131881/36296 Jan 28, 2017 at 16:15
• Explanation: tex.stackexchange.com/a/103974/36296 Jan 28, 2017 at 16:17
• Thank you for clarifying the problem! Although it appears related to a well-known bug in Beamer (can we patch this? is there a better forum for reporting bugs?), I wasn't able to find the solution for the specific defect I noticed (right margin), so I think I'll leave the question up even though it is slightly redundant, if it can help route searches toward a workaround? Jan 29, 2017 at 14:54
• Have you tried the workrounds I linked in the first comment? I tried the "Redefinition of block-environment" with your theme and get all your blocks aligned on the right margin. Jan 29, 2017 at 15:09
• Yes, I just tried your solution and the workaround works. Thank you! Jan 29, 2017 at 15:21

Workaround:

\documentclass[]{beamer}
%% Set up as beamerposter
%\usepackage{grffile}
%\usepackage{hyperref}
\usepackage{calc}
%\usepackage{tcolorbox}
%\usepackage{lmodern}% http://ctan.org/pkg/lm

%\ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/themes/theme/beamerthemeSingapore.sty,v d02a7cf4d8ae 2010/06/17 09:11:41 rivanvx$
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{frametitle}[default][center]
\AtBeginDocument{%
{
}
{%
color(0cm)=(bg);
}
}
\beamertemplatedotitem
\mode
<all>

% Template from T has special colors
\definecolor{TYellow}{RGB}{234,230, 99}
\definecolor{TBlue}{RGB}{ 29, 23, 96}
\definecolor{TAzure}{RGB}{151,147,204}
\definecolor{TWhite}{RGB}{255,255,255}
\definecolor{TPale}{RGB}{232,229,177}
\definecolor{VABlue}{RGB}{25,73,128}
\definecolor{RUST}{HTML}{EB7A59}
\definecolor{AZURE}{HTML}{5AA0DF}
\definecolor{OCHRE}{HTML}{EEA300}
\definecolor{TURQUOISE}{HTML}{00BAC9}
\definecolor{BLACK}{HTML}{44525C}
\definecolor{WHITE}{HTML}{F1F0E9}

% Configure the colors for the headline
\setbeamercolor{logobox}{bg=BLACK}
\setbeamercolor{block title}{bg=white,fg=VABlue}
\setbeamercolor{block body}{bg=WHITE,fg=black}
\setbeamercolor{block title}{bg=BLACK,fg=TWhite}

% define a new register to hold an intermediate size calculation
% that we'll use in defining the headline
\newlength{\residual}

\leavevmode

\setlength{\residual}{\paperwidth-20cm}

\begin{columns}[c]
\begin{column}{1cm}
\end{column}

\begin{column}[b]{9cm}
\end{column}

\begin{column}{\residual}
\vskip1cm
\centering
\color{fg}{\Huge\selectfont {\inserttitle}}\\[3ex]}
\color{fg}\Large{\insertauthor}\\[1ex]}
\color{fg}\large{\insertinstitute}\\[1ex]}
\end{column}

\begin{column}[t]{9cm}
\end{column}

\begin{column}{1cm}
\end{column}
\end{columns}
\vskip2ex
\end{beamercolorbox}

\rule{0pt}{3pt}
\end{beamercolorbox}
}

% Alignment grid
%\beamertemplategridbackground[1cm]

% no navigation on a poster

% 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]

\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\large}

% Enable T1 (more modern) fonts
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}

\usepackage{grffile}
\usepackage{ragged2e}
\usepackage{amsmath,amsthm, amssymb, latexsym}

\title[]{Title}
\author[]{Authors}
\date{}
\institute[]{Institute}

\newsavebox{\squaredblocktext}
\setbeamertemplate{block begin}{
\par\vskip\medskipamount%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex]{block title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}}%
\begin{lrbox}{\squaredblocktext}%
\begin{minipage}[t]{\textwidth}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\setbeamertemplate{block end}{
\end{minipage}%
\end{lrbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title}{}
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
\usebox{\squaredblocktext}
\end{beamercolorbox}%
}\vskip\smallskipamount%
}

\begin{document}

\setlength\columnsep{0pt}

\begin{frame}{}

\begin{block}{}
I've placed hrules in the columns to show that the spacing error comes from the column environment and not the block environment.\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\vspace{5em}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{block}

The problem is not related to Beamer blocks as "naked" columns show the same issue:\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}

\end{frame}
\end{document}