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.

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%
\insertframenumber\,/\,\inserttotalframenumber}
\setbeamertemplate{footline}[frame number] 
\setbeamertemplate{blocks}[rounded][shadow=true] 
\setbeamertemplate{navigation symbols}{} 
\usetheme{Ilmenau}

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

\usepackage{etoolbox}
\ifthenelse{\boolean{circles}}{\makeatletter
\patchcmd{\slideentry}{\advance\beamer@xpos by1\relax}{}{}{}
\def\beamer@subsectionentry#1#2#3#4#5{\advance\beamer@xpos by1\relax}%
\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

share|improve this question

2 Answers 2

New answer

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:

Without - start

With - start

With - underway

Without - later

produced by

\documentclass[slidestop,compress,10pt,xcolor=dvipsnames]{beamer}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
  \oldmacro\hfill%
\insertframenumber\,/\,\inserttotalframenumber}
\setbeamertemplate{footline}[frame number] 
\setbeamertemplate{blocks}[rounded][shadow=true] 
\setbeamertemplate{navigation symbols}{} 
\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%
      \advance\beamer@tempdim by-\beamer@boxsize%
      \multiply\beamer@tempdim by\beamer@ypos%
      \advance\beamer@tempdim by -.05cm%
      \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}%
                \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}

Previous answer

(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.

Changed

Unchanged

\documentclass[slidestop,compress,10pt,xcolor=dvipsnames]{beamer}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
  \oldmacro\hfill%
\insertframenumber\,/\,\inserttotalframenumber}
\setbeamertemplate{footline}[frame number] 
\setbeamertemplate{blocks}[rounded][shadow=true] 
\setbeamertemplate{navigation symbols}{} 
\usetheme{Ilmenau}

\usepackage{etoolbox}
\makeatletter
\let\oldbeamer@subsectionentry\beamer@subsectionentry
\let\old@slideentry\slideentry
\def\subscircles{%
\patchcmd{\slideentry}{\advance\beamer@xpos by1\relax}{}{}{}
\def\beamer@subsectionentry##1##2##3##4##5{\advance\beamer@xpos by1\relax}}
\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.

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

headline for "First subsection" (cropped) headline for "Long subsection" (cropped): only one mini frame for the entire subsection headline for "Third subsection" (cropped)

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.

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.