Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
%\setbeamertemplate{headline}[miniframes theme]
\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:

enter image description here

These are with split:

enter image description here

And I want something like this mockup:

enter image description here

share|improve this question
    
"everything is possible with TeX". It sounds very encouraging, but I'll stick with Matthew 19:26 :^) –  Steven B. Segletes Feb 25 at 16:00
    
@StevenB.Segletes Do you mean that "With men this is impossible"? –  Jellby Feb 25 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 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. –  jenson_bo Feb 25 at 16:05
2  
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 at 16:24

1 Answer 1

up vote 3 down vote accepted

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

enter image description here

\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

\def\insertsubsectionnavigationhorizontalminiframes#1#2#3{%
  \hbox to #1{{%
    \usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
    \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%
        \advance\beamer@tempdim by -\beamer@boxsize%
        \advance\beamer@tempdim by 2pt%
        \ifnum##2>1%
          \advance\beamer@tempdim by 1.875ex%
        \else
          \advance\beamer@tempdim by -\beamer@boxsize%
        \fi
      \else
        \beamer@tempdim=0pt%
      \fi
      \setbox\beamer@sectionbox=
      \hbox{\def\insertsubsectionhead{\kern\beamer@tempdim##5}%
         \def\insertsectionheadnumber{##1}%
         \def\insertsubsectionheadnumber{##2}%
         \def\insertpartheadnumber{##6}%
         \ifnum\c@subsection=##2%
        \beamer@link(##4){{\usebeamertemplate{subsection in head/foot}}}\else%
        \beamer@link(##4){{\usebeamertemplate{subsection in head/foot shaded}}}\fi}%
      \ht\beamer@sectionbox=1.875ex%
      \dp\beamer@sectionbox=0.75ex%
      \else%
      \beamer@prev@miniframes=##3%
      \fi%
      \setbox0=\hbox{\insertsectionhead\unskip}\ifdim\wd0>0pt\ifnum##3>0%
      \beamer@xpos=##3\relax%
      \advance\beamer@xpos by -\beamer@xoff%
      \hbox to 0pt{%
        \beamer@tempdim=0.5pt%
        \raise\beamer@tempdim\hbox{%
          \ifnum##2>0%
            \beamer@tempdim=\beamer@boxsize%
            \multiply\beamer@tempdim by\beamer@xpos%
            \advance\beamer@tempdim by -\beamer@boxsize%
            \advance\beamer@tempdim by 2pt%
            \advance\beamer@tempdim by \wd\beamer@sectionbox%
          \else%
            \beamer@tempdim=\beamer@boxsize%
            \multiply\beamer@tempdim by\beamer@xpos%
            \advance\beamer@tempdim by 1.875ex%
          \fi%
          \kern\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}%
                  \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{}%
    \hskip-1.875ex plus-1fill\dohead%
    \box\beamer@sectionbox\hfil\hskip.3cm%
    #3}}}

\setbeamercolor{mini frame}{parent=subsection in head/foot}

\ifbeamer@compress

\defbeamertemplate*{headline}{split theme miniframes}
{%
  \leavevmode%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
    \insertsectionnavigationhorizontal{.5\paperwidth}{\hskip0pt plus1filll}{}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
    \insertsubsectionnavigationhorizontalminiframes{.5\paperwidth}{}{\hskip0pt plus1filll}%
  \end{beamercolorbox}%
}

\else

\defbeamertemplatealias{headline}{split theme miniframes}{split theme}
\setbeamertemplate{headline}[split theme miniframes]

\fi

\makeatother

% This is to enable the feature
\setbeamertemplate{headline}[split theme miniframes]

\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.