2

I'm creating a new beamer theme which mimics an exisiting powerpoint template. I've spent quite some time to make the footlines in both types of document overlap, only to find out that the position of my footline depends on the chosen font size.

Here's a MWE (with a dummy logo in the correct position):

\documentclass[12pt]{beamer}%Changing the size here moves the footline logo
\usepackage{tikz}
\title{Hello world!}
\setbeamertemplate{footline}{%
\begin{beamercolorbox}[wd=\paperwidth,ht=.0769\paperheight,dp=0mm]{title in head/foot}%
\begin{center}%
\begin{tikzpicture}
\draw[fill=blue] (0.7094\paperwidth,0) rectangle (.9286484375\paperwidth,.0769\paperheight);
\draw[fill=blue] (0,.017\paperheight) rectangle (.6845\paperwidth,0.05\paperheight);
\end{tikzpicture}%
\end{center}%
\end{beamercolorbox}%
}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\maketitle
\end{document}

Here's a comparison between the 12pt and 15pt results, I've used the 15pt result as a background and painted the 12pt result red: Comparison

The 12pt case (red) has a footline slightly above the 15pt case. Why does this happen? The paperwidth/paperheight shouldn't depend on the font size so I don't see how it can affect the position.

Please let me know if you cannot reproduce the phenomena.

  • 2
    I think the problem comes from using center. Try to replace it with \centering. Does it solve the problem? – Ignasi Oct 08 '15 at 20:09
  • @Ignasi, that changed the output completely. I'll do some experimenting with this and let you know! –  Oct 08 '15 at 20:14
  • @Ignasi Yes! That was it. Do you have any idea how/why the center environment is affected by the font size? Is it a beamer behaviour or a more general behaviour? –  Oct 08 '15 at 20:24
  • I think the space before and after center is proportional to font size. – Ignasi Oct 08 '15 at 20:44

1 Answers1

2

This is the definition of the center environment:

\def\center{\trivlist \centering\item\relax}

and:

\def\endcenter{\endtrivlist}

\centering is defined as follows:

\def\centering{%
  \let\\\@centercr
  \rightskip\@flushglue\leftskip\@flushglue
  \parindent\z@\parfillskip\z@skip}

\trivlist is defined as:

\def\trivlist{%
  \parsep\parskip
  \@nmbrlistfalse
  \@trivlist
  \labelwidth\z@
  \leftmargin\z@
  \itemindent\z@
  \let\@itemlabel\@empty
  \def\makelabel##1{##1}}

and we have:

\def\@trivlist{%
  \if@noskipsec \leavevmode \fi
  \@topsepadd \topsep
  \ifvmode
    \advance\@topsepadd \partopsep
  \else
    \unskip \par
  \fi
  \if@inlabel
    \@noparitemtrue
    \@noparlisttrue
  \else
    \if@newlist \@noitemerr \fi
    \@noparlistfalse
    \@topsep \@topsepadd
  \fi
  \advance\@topsep \parskip
  \leftskip \z@skip
  \rightskip \@rightskip
  \parfillskip \@flushglue
  \par@deathcycles \z@
  \@setpar{\if@newlist
             \advance\par@deathcycles \@ne
             \ifnum \par@deathcycles >\@m
               \@noitemerr
               {\@@par}%
             \fi
           \else
             {\@@par}%
           \fi}%
  \global \@newlisttrue
  \@outerparskip \parskip}

\endtrivlist is:

\def\endtrivlist{%
  \if@inlabel
    \leavevmode
    \global \@inlabelfalse
  \fi
  \if@newlist
    \@noitemerr
    \global \@newlistfalse
  \fi
  \ifhmode\unskip \par
  \else
    \@inmatherr{\end{\@currenvir}}%
  \fi
  \if@noparlist \else
    \ifdim\lastskip >\z@
      \@tempskipa\lastskip \vskip -\lastskip
      \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
      \vskip\@tempskipa
    \fi
    \@endparenv
  \fi
}

The vertical spacing here is relative to the font size. For example, Beamer defines \parskip as \setlength\parskip{0\p@}% \@plus \p@} and \p@ is relative to font size.

Hence, the vertical spacing depends on the font size.

In contrast, while \centering inserts skips which depend on font size, these affect only the horizontal spacing - not the vertical.

In general, if you don't want to alter the vertical spacing (or you don't want that spacing to depend on font size or to be stretchy), the center environment is not the right choice.

cfr
  • 198,882