The problem here is that the outer theme smoothbars
uses the beamer option compress
in order to get the mini frames into one single line, while miniframes
doesn't do that by default. So in order to remove the spurious space, you need to activate this compression, which can be done by saying
\beamer@compresstrue
in beamerthemeM21.sty
(enclosed in \makeatletter ... \makeatother
, of course).
BTW: You don't need to use \setcounter{subsection}{1}
in each section as in your MWE, doing this once (e. g. in your theme file) is enough.
So the corrected beamerthemeM21.sty
looks like this:
\usepackage{remreset}
\makeatletter
\@removefromreset{subsection}{section}
\beamer@compresstrue
\makeatother
\setcounter{subsection}{1}
\mode<presentation>
\setbeamercovered{transparent}
\mode<all>
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{}
The mini frames are generated using the \beamer@framepages
entries in the auxiliary .nav
file. If you remove these for certain frames, they don't appear in the navigation1. To do so, you have to patch the \beamer@writeslidentry
macro responsible for writing the commands to the .nav
file:
\makeatletter
\let\beamer@writeslidentry@miniframeson=\beamer@writeslidentry
\def\beamer@writeslidentry@miniframesoff{%
\expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
{%else
% removed \addtocontents commands
\clearpage\beamer@notesactions%
}
}
\newcommand*{\miniframeson}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframeson}
\newcommand*{\miniframesoff}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframesoff}
\makeatother
Include this code in your document, then you can switch between the original implementation and the modified one not generating any mini frames by using \miniframeson
and \miniframesoff
.
1This may, however, have some unwanted consequences I'm not aware of!
Full example code:
\documentclass[compress]{beamer}
\useoutertheme[subsection=false]{miniframes}
\makeatletter
\let\beamer@writeslidentry@miniframeson=\beamer@writeslidentry
\def\beamer@writeslidentry@miniframesoff{%
\expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
{%else
% removed \addtocontents commands
\clearpage\beamer@notesactions%
}
}
\newcommand*{\miniframeson}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframeson}
\newcommand*{\miniframesoff}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframesoff}
\makeatother
\begin{document}
\section{S1}
\subsection{SS1}
\frame{1}
\miniframesoff
\frame{2}
\miniframeson
\frame{3}
\subsection{SS2}
\miniframesoff
\frame{1}
\miniframeson
\frame{2}
\frame{3}
\end{document}
Resulting headline (only four of six mini frames are displayed):
Best Answer
Second solution including framenumbers