1

Beamer documentatoin:

8.2.2 The Sidebars
Sidebars are vertical areas that stretch from the lower end of the headline to the top of the footline

I created a left sidebar that does not behave as described in the Beamer documentation (see excerpt above), since its beginning is overlapping the area of the headline a bit (see figure below).

enter image description here

The presentation was generated by the code:

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}

\setbeamersize{text margin left=0pt,text margin right=0pt} 

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{headline}{%
    \setlength{\fboxsep}{2.5pt}%
    \setlength{\fboxrule}{0.5pt}%
    \framebox[\textwidth][r]{\insertframenumber{ / }\inserttotalframenumber\hfill\insertshortdate}%
}%

\setbeamertemplate{footline}{%
        \setlength{\fboxsep}{2.5pt}%
        \setlength{\fboxrule}{0.5pt}%
        \framebox[\textwidth][r]{\insertshortdate\hfill\insertframenumber{ / }\inserttotalframenumber}%
}%

\setbeamersize{sidebar width left=2cm}
\setbeamertemplate{sidebar left}{
    \setlength{\fboxsep}{0.0pt}%
    \setlength{\fboxrule}{0.5pt}%
    \framebox[2\width]{\small UNISIM}%
    %\framebox[2cm]{\includegraphics[height=1.0cm]{figs/fig1.png}}%
}%

%\setbeamertemplate{sidebar canvas left}[vertical shading][top=blue!70!black, bottom=red!70!black]%

\setbeamertemplate{background}[grid]%

\setbeamertemplate{background canvas}{%
    \begin{tikzpicture}
        \node[opacity=0.5,inner sep=0pt] at (current page.center)
        {\includegraphics[width=\paperwidth,height=\paperheight]{figs/fig1.png}};
    \end{tikzpicture}
}%

\title{Sample title}

\begin{document}

\frame{\titlepage}
\section{Introduction}
\begin{frame}
First Introduction Frame
\end{frame}

\begin{frame}
Second Introduction Frame
\end{frame}

\section{Review}
\begin{frame}
First Review
\end{frame}
\end{document}

Questions:

  1. What is the explanation for the mentioned, apparently abnormal, behavior?
  2. How can I fix it?

Motivations: I am building a personalized presentation and, for that, I am exploring Beamer and Latex commands. Here, I am trying to get used to some Beamer customization features while learn how to deal with boxes.

1
  • Take a look at file beamerouterthemesidebar.sty
    – user94293
    Dec 5, 2019 at 14:27

1 Answer 1

2

8.2.1 The Headline and Footline, from beameruserguide.pdf
The size of the headline and the footline is determined as follows: Their width is always the paper width. Their height is determined by tentatively typesetting the headline and the footline right after the \begin{document} command. The head of the headline and the footline at that point is “frozen” and will be used throughout the whole document, even if the headline and footline vary in height later on (which they should not).

Apparently, the estimation of the height of the headline doesn't work as you expected (but it works well enough for the footline). It seems that "height" doesn't refer to totalheight but rather to height, the differences are explained e.g. here.

One way around is to use \raisebox to change your custom headline from a box with height and depth to a box with only height. Full example (with all parts of your code not necessary for this feature removed):

\documentclass[aspectratio=169]{beamer}

\setbeamertemplate{headline}{%
    \setlength{\fboxsep}{2.5pt}%
    \setlength{\fboxrule}{0.5pt}%
    \raisebox{\dimexpr\dp\strutbox+\fboxsep+\fboxrule}[\dimexpr\ht\strutbox+\dp\strutbox+2\fboxsep+2\fboxrule][0pt]{\framebox[\textwidth][r]{\strut\insertframenumber{ / }\inserttotalframenumber\hfill\insertshortdate}}%
}%

\setbeamertemplate{footline}{%
        \setlength{\fboxsep}{2.5pt}%
        \setlength{\fboxrule}{0.5pt}%
        \framebox[\textwidth][r]{\insertshortdate\hfill\insertframenumber{ / }\inserttotalframenumber}%
}%

\setbeamersize{sidebar width left=2cm}
\setbeamertemplate{sidebar left}{
    \setlength{\fboxsep}{0.0pt}%
    \setlength{\fboxrule}{0.5pt}%
    \framebox[2\width]{\small UNISIM}%
    \vfill
    \framebox[2\width]{\small UNISIM}%
}

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

enter image description here

2
  • One question, where can I learn about all the commands that you used in raisebox? There is a some king of Tex Essentials documentation?
    – Randerson
    Dec 5, 2019 at 18:12
  • I never used a big documentation to learn TeX, all of the macros used here I came into contact with in previous questions on this site.
    – Tiuri
    Dec 6, 2019 at 10:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .