# How do you remove spacing from multiple beamer color boxes on the same line?

I am working on my own Beamer theme for use in presentations. Along the bottom (in the footline) I want to have three color boxes in a row which have different colors.

Within my theme.sty file I have done this by:

\setbeamertemplate{footline}{
\leavevmode
\begin{beamercolorbox}[wd=0.33\paperwidth,ht=7pt,dp=4pt]{footerbox}
\centering
\insertauthor
\end{beamercolorbox}
\begin{beamercolorbox}[wd=0.34\paperwidth,ht=7pt,dp=4pt]{footerboxcenter}
\centering
\inserttitle
\end{beamercolorbox}
\begin{beamercolorbox}[wd=0.33\paperwidth,ht=7pt,dp=4pt]{footerbox}
\centering
\end{beamercolorbox}
}


What I end up with is

This is basically what I want except without the space between the boxes. The exact content and ratios of each box may change - the point here is just multiple color boxes on one line. I've tried playing around with various formatting, columns, minipages, hspace, etc, and have not managed to eliminate this space.

I'm imagining there's some command or argument I'm missing here, or there may be a more "LaTeX-ish" way of accomplishing the effect I want. Is there anything I'm doing obviously wrong? And/or is there a more appropriate way to put several color boxes on one line?

You need % after \end{beamercolorbox}, otherwise the unprotected line ending is like inserting a space. See What is the use of percent signs (%) at the end of lines? for more information about line endings as spaces.

Furthermore you can avoid using \centering in each beamercolorbox if you pass center as option the the beamercolorbox.

\documentclass{beamer}

\setbeamercolor{footerbox}{bg=blue, fg=white}
\setbeamercolor{footerboxcenter}{bg=red}

\setbeamertemplate{footline}{%
\leavevmode
\begin{beamercolorbox}[wd=0.33\paperwidth,ht=7pt,dp=4pt,center]{footerbox}
\insertauthor
\begin{beamercolorbox}[wd=0.34\paperwidth,ht=7pt,dp=4pt,center]{footerboxcenter}
\inserttitle
\begin{beamercolorbox}[wd=0.33\paperwidth,ht=7pt,dp=4pt,center]{footerbox}
\end{beamercolorbox}
}

\begin{document}

\begin{frame}
abc
\end{frame}

\end{document}


• Perfect! This is the second time you've answered one of my questions - you really know your stuff! Thanks for the explanation too. – fergu Nov 11 '18 at 1:01
• @fergu You're welcome! Have fun with beamer! – samcarter is at topanswers.xyz Nov 11 '18 at 11:33