# Smoothbars meets infolines

I like the intuitive navigation that smoothbars provides. However, when the presentation has too many sections it is hard to display it nicely. In that case I would like to have a split header like infolines.

Thus, how can I have the best of both worlds, have the navigation of smoothbars and the split header of infolines, like this:

I have the section in the left, and the navigation on the right. I searched, but without any success.

\documentclass{beamer}
\usetheme{Warsaw}
\useoutertheme[subsection=false]{smoothbars}
%\useoutertheme{infolines}
\begin{document}
\section{Test}
\subsection{test1}
\frame{one}
\subsection{test1}
\frame{one}
\section{Test 2}
\subsection{test1}
\frame{one}
\frame{two}
\subsection{test1}
\frame{one}
\section{Test 3}
\subsection{test1}
\frame{one}
\frame{three}
\subsection{test1}
\frame{one}
\end{document}


## 1 Answer

You can define your own navigation bar displaying only the mini frames of the current section for use in the headline template:

\documentclass{beamer}
\usetheme{Warsaw}
\useoutertheme[subsection=false]{smoothbars}

% Smoothbars meets infolines
% (http://tex.stackexchange.com/a/112571)
\makeatletter
\def\insertminiframescurrentsection{%
\def\sectionentry##1##2##3##4##5{}
\def\slideentry##1##2##3##4##5##6{%
%section number, subsection number, slide number, first/last frame, page number, part number
\ifnum##6=\c@part\ifnum##1=\c@section\ifnum##2>0\ifnum##3>0%
\advance\beamer@xpos by1\relax%
\hbox to 0pt{%
\beamer@tempdim=-\beamer@vboxoffset%
\advance\beamer@tempdim by-\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@ypos%
\raise\beamer@tempdim\hbox{%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 1pt%
\kern\beamer@tempdim
\global\beamer@section@min@dim\beamer@tempdim
\hbox{\beamer@link(##4){%
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%\beamer@minislidehilight%
\else%
\usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi\fi%
\ignorespaces
}
\vbox{{%
\usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
\beamer@xpos=0\relax%
\beamer@ypos=0\relax%
\hbox{\setbox\beamer@sectionbox=\hbox{\kern1sp}%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\hskip-1.875ex plus-1fill%
\global\beamer@section@min@dim\z@
\dohead%
\beamer@section@set@min@width
\box\beamer@sectionbox\hfil\hskip.3cm}%
}}}

\AtBeginDocument
{
\usebeamerfont*{headline}
\colorlet{global.bg}{bg}
\usebeamercolor{subsection in head/foot}
\usebeamercolor{section in head/foot}
\usebeamercolor{frametitle}
\pgfdeclareverticalshading{beamer@barshade}{\the\paperwidth}{%
color(0ex)=(global.bg);%
color(1ex)=(section in head/foot.bg);%
color(5ex)=(section in head/foot.bg)%
}
}

\setbeamertemplate{headline}
{
\pgfuseshading{beamer@barshade}\vskip-5ex% Remove this line if you don't want a shadow below the headline
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,left]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertminiframescurrentsection
\end{beamercolorbox}}%
\vskip0pt%
}

\setbeamertemplate{frametitle}
{%
\nointerlineskip%
\usebeamerfont{headline}%
\begin{beamercolorbox}[wd=\paperwidth,leftskip=.3cm,rightskip=.3cm plus1fil,vmode]{frametitle}
\vskip.5ex
\usebeamerfont*{frametitle}\insertframetitle%
\ifx\insertframesubtitle\@empty%
\strut\par%
\else
\par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
\fi%%
\usebeamerfont{headline}%
\vskip.5ex
\end{beamercolorbox}%
\nointerlineskip
\begin{beamercolorbox}[wd=\paperwidth,ht=.5ex,dp=0ex]{empty}
\pgfuseshading{beamer@belowframetitle}%
\end{beamercolorbox}%
}
\makeatother

\begin{document}
\section{Test}
\subsection{test1}
\begin{frame}{Title}one\end{frame}
\subsection{test1}
\frame{one}
\section{Test 2}
\subsection{test1}
\frame{one}
\frame{two}
\subsection{test1}
\frame{one}
\section{Test 3}
\subsection{test1}
\frame{one}
\frame{two}
\frame{three}
\subsection{test1}
\frame{one}
\end{document}


The code of the navigation bar named \insertframescurrentsection is very similar to the default mini frame navigation (\insertnavigation in beamerbasenavigation.sty) , I just removed the display of the section title and added a check to ensure that only the mini frames of the current section are displayed.

This "bare" mini frames line is then used in the beamer template headline, which is a copy of the infolines headline with the display of the subsection name replaced by the custom navigation bar.

• That works excellent for the navigation. However, when you have a title the gradient in the smoothbars does not exist in the navigation part, and you get a step instead. Test with \begin{frame}{Title}one\end{frame} you will see. – adn May 5 '13 at 11:54
• @adn I see - themes including shadows can be tricky sometimes... I added a redefinition of the beamer template frametitle to my answer which hopefully solves the problem. – diabonas May 5 '13 at 12:20
• Thanks that solves the problem. Is there a way to include the shadows? or I have to live without them? – adn May 6 '13 at 0:54
• @adn You can define your own shadow below the headline, see my edit. I left out the shadow between the headline and the frame title (if present) though, because it looks very weird due to the bi-colored headline. – diabonas May 8 '13 at 14:57