# Show miniframes with split outer themes

I'd like to combine the split and miniframes themes of beamer. For example, I would have the miniframes appear in the right half of the title bar (where the subsections appear). If there are any subsections, I'd have the miniframes below or next to the subsection title. This is a sample document.

\documentclass[compress,aspectratio=43]{beamer}

\useoutertheme{miniframes}
\useoutertheme{split}
\usecolortheme{whale}

\begin{document}

\section{First Section}
\frame{} \frame{} \frame{}

\section{Second Section}

\subsection{sub1}
\frame{} \frame{} \frame{}

\subsection{sub2}
\frame{} \frame{} \frame{}

\end{document}


I won't ask if it's possible, because everything is possible with TeX, but rather whether someone can help me :)

To show what I mean, these are the headlines with miniframes:

These are with split:

And I want something like this mockup:

-
"everything is possible with TeX". It sounds very encouraging, but I'll stick with Matthew 19:26 :^) – Steven B. Segletes Feb 25 '14 at 16:00
@StevenB.Segletes Do you mean that "With men this is impossible"? – Jellby Feb 25 '14 at 16:02
I guess we'll have to wait for egreg or David to sweep over the face of the waters, and bring some light. – Steven B. Segletes Feb 25 '14 at 16:04
I don't really get what you mean. What do you mean by combining miniframe and split? Maybe you can make a mock up of how it should look with and without subsections. – jens_bo Feb 25 '14 at 16:05
Usually, in these situations, the way to proceed is to pick up the relevant code from the miniframes outer theme and to combine it with the current split outer theme. @StevenB.Segletes: I won't call egreg or David for this (no offense of course ;) ), but definitely Gonzalo! – Claudio Fiandrino Feb 25 '14 at 16:24

This seems to be working as I indended. It's a bit hackish, and it only works with the compress option.

\documentclass[compress,aspectratio=43]{beamer}

\useoutertheme{miniframes}
\useoutertheme{split}
\usecolortheme{whale}

% For convenience, move this to a style or theme file
\makeatletter

\newcount\beamer@xoff
\newcount\beamer@prev@section
\newcount\beamer@prev@miniframes
\beamer@xoff=0
\beamer@prev@section=0
\beamer@prev@miniframes=0

\hbox to #1{{%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{%
\ifnum##1>\beamer@prev@section%
\beamer@xoff=##3\relax%
\beamer@prev@miniframes=0\relax%
\fi
\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\beamer@xoff=0\relax%
\beamer@currentsubsection=##2%
\box\beamer@sectionbox\hskip1.875ex plus1fill%
\ifnum\beamer@prev@miniframes>0\relax%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by \beamer@prev@miniframes%
\ifnum##2>1%
\else
\fi
\else
\beamer@tempdim=0pt%
\fi
\setbox\beamer@sectionbox=
\ifnum\c@subsection=##2%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\else%
\beamer@prev@miniframes=##3%
\fi%
\beamer@xpos=##3\relax%
\hbox to 0pt{%
\beamer@tempdim=0.5pt%
\raise\beamer@tempdim\hbox{%
\ifnum##2>0%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\else%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\fi%
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%
\else%
\usebeamertemplate{mini frame in current subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi%
\else%
\fakeslideentry{##1}{##2}{##3}{##4}{##5}{##6}%
\fi\fi%
\beamer@prev@section=##1%
\ignorespaces}%
#2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
\box\beamer@sectionbox\hfil\hskip.3cm%
#3}}}

\ifbeamer@compress

{%
\leavevmode%
\end{beamercolorbox}%
\end{beamercolorbox}%
}

\else

\fi

\makeatother

% This is to enable the feature

\begin{document}
\frame{\titlepage}
\frame{\tableofcontents} % no miniframes in the front matter (good)
\section{First Section}
\frame{} \frame{} \frame{} % miniframes without subsections (good)
\section{Second Section}
\subsection{Subsection 1}
\frame{} \frame{}
\subsection{Subsection 2}
\frame{} \frame{} \frame{}
\section{Third Section} % correct miniframes with mixed sections/subsections
\frame{} \frame{} \frame{}
\subsection{Subsection 3}
\frame{} \frame{} \frame{}
\section*{} % no miniframes in back matter (good)
\frame{End}
\end{document}

-