# Locally use only one smoothbar bullet within one subsection

Inspired from this question Modify Beamer's outer theme smoothbars I want to apply one smoothbar only locally, in only one long subsection that is.

I thought of defining a new boolean variable but it seems that it's not working...

My code is

\documentclass[slidestop,compress,10pt,xcolor=dvipsnames]{beamer}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\setbeamertemplate{footline}[frame number]
\usetheme{Ilmenau}

\usepackage{ifthen}
\newboolean{circles}%Define new variable
\setboolean{circles}{false}%Set the variable false

\usepackage{etoolbox}
\ifthenelse{\boolean{circles}}{\makeatletter
\makeatother}

\begin{document}

\section{Results}

\subsection{First Subsection}
\frame{Frame 0}

\subsection{Long Subsection}
\setboolean{circles}{true}%Set the variable true only for this long subsection
\frame{Frame 1}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}

\subsection{Third Subsection}
\setboolean{circles}{false}%Set the variable back to false
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}

\end{document}


EDIT

The output of Andrew Swann's answer is

-

If you wish to have the subsection circles in just selected subsections and not throughout the presentation, then you can provide different definitions of \slideentry and commands to switch to one of these new definitions.

In the code below,

• \slideentry@subsections provides circles for just the current subsection, one switches to this style with \subcircles
• \slideentry@none removes the circles completely and their line, the switch command is \nocircles
• \slideentry@old is the original definition, switched to with \stdcircles.

Starting with \nocircles and switching them on with \subcircles in the second section, then switching off again in the third section gives the following:

produced by

\documentclass[slidestop,compress,10pt,xcolor=dvipsnames]{beamer}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\setbeamertemplate{footline}[frame number]
\usetheme{Ilmenau}

\makeatletter
\def\slideentry@subsections#1#2#3#4#5#6{%
%section number, subsection number, slide number, first/last frame, page number, part number
\ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
\ifnum\c@section=#1\ifnum\c@subsection=#2%
\beamer@xpos=#3\relax%
\hbox to 0pt{%
\beamer@tempdim=-\beamer@vboxoffset%
\multiply\beamer@tempdim by\beamer@ypos%
\raise\beamer@tempdim\hbox{%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\kern\beamer@tempdim
\global\beamer@section@min@dim\beamer@tempdim
\usebeamerfont{mini frame}%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=#3%
\usebeamertemplate{mini frame}%
\else%
\usebeamertemplate{mini frame in current subsection}%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi\fi\fi%
\fi\ignorespaces
}
\def\slideentry@none#1#2#3#4#5#6{}
\let\slideentry@old\slideentry
\def\subcircles{\let\slideentry\slideentry@subsections}
\def\nocircles{\let\slideentry\slideentry@none}
\def\stdcircles{\let\slideentry\slideentry@old}
\makeatother

\begin{document}

\section{Results}

\subsection{First Subsection}
\nocircles
\frame{Frame 0}

\subsection{Long Subsection}
\subcircles
\frame{Frame 1}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}

\subsection{Third Subsection}
\nocircles
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}

\end{document}


(Kept because of dicussion of the posted code.)

One problem with you code is that the \ifthenelse is exected only once, in the preamble. The other problem is that it irrevocably patches \slideentry that needs to be switched back to its standard definition afterwards.

My choice would be to define two commands, one (\subcircles) to turn on the new style, one (\stdcircles) to restore the old stlye. Here is one implementation.

\documentclass[slidestop,compress,10pt,xcolor=dvipsnames]{beamer}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\setbeamertemplate{footline}[frame number]
\usetheme{Ilmenau}

\usepackage{etoolbox}
\makeatletter
\let\oldbeamer@subsectionentry\beamer@subsectionentry
\let\old@slideentry\slideentry
\def\subscircles{%
\def\stdcircles{%
\let\slideentry\old@slideentry
\let\beamer@subsectionentry\oldbeamer@subsectionentry
}
\makeatother

\begin{document}

\section{Results}

\subsection{First Subsection}
\frame{Frame 0}

\subsection{Long Subsection}
\subscircles
\frame{Frame 1}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}

\subsection{Third Subsection}
\stdcircles
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}

\end{document}


The old commands \beamer@subsectionentry and \slideentry are stored, so the restoration process is easy. The changing command \subcircles just implements your patch command process for \slideentry and your redefiniton of \beamer@subsectionentry.

-
Thank you very much for your answer. There is an issue though... The "extra" smoothbars dissapear only in the specified subsection. On the other ones, the smoothbars are as many as the frames. Please check my edited question to see what I am talking about... –  Thanos Feb 20 '13 at 9:54
Do want to completely remove the smoothbars in the other sections? –  Andrew Swann Feb 20 '13 at 10:28
Exactly!!! Otherwise there is no point, is it? ;) –  Thanos Feb 20 '13 at 11:19

The problem with the solution you linked is that it controls only the appearance of the mini frames in order to remove the superfluous ones, the mini frames themselves are still there and keep reappearing in other subsections. To avoid this, you have to physically remove them, quite similar to the solution provided in How to remove some pages from the navigation bullets in Beamer?:

\documentclass[compress]{beamer}
\usetheme{Ilmenau}

% http://tex.stackexchange.com/a/102459
\usepackage{etoolbox}
\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}
\newenvironment{hideminiframes}{\miniframesoff\patchcmd{\slideentry}{\usebeamertemplate{mini frame in current subsection}}{\usebeamertemplate{mini frame}}{}{}}{\miniframeson}
\makeatother

\begin{document}

\section{Results}

\subsection{First Subsection}
\frame{Frame 0}

\subsection{Long Subsection}
\frame{Frame 1}
\begin{hideminiframes}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}
\end{hideminiframes}

\subsection{Third Subsection}
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}

\end{document}


The use is simple: In the subsections where you want only one mini frame for the entire subsection, enclose all the frames but the first one in a hideminiframes environment.

The implementation is the same as in the answer already mentioned, but for one little detail: The single mini frame for the long subsection should be highlighted throughout the whole subsection, which is achieved by patching an internal beamer command in order to use the (highlighted) template mini frame all the time instead of the unhighlighted mini frame in current subsection.

-