2

I have problem with empty subsections -- they are added even, when I set them using \section*{}.

My MWE:

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usetheme{warsaw}
\setbeamercovered{transparent}
\begin{document}

\section{section 1}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\subsection*{}
\begin{frame}\end{frame}

\section{section 2}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\section{section 3}
\begin{frame}\end{frame}

\end{document}

In the navigation of section 1, there are 5 lines (last one has empty title), but in section 2, there are 4 lines.

How to force beamer not to add the last empty subsection? Empty section is not added to the navigation bar.

Section with 4 subsections and one empty subsection at the end: Section with 4 subsections and one empty subsection at the end

Section with only 4 subsections: Section with only 4 subsections

  • Well, you could comment it out, but I don't think that's what you mean. Are you trying to prohibit them from appearing in a table of contents somewhere? – Sean Allred May 25 '15 at 13:49
  • What do you mean by "prohibit them from appearing..."? I know what I can do, but it is not so nice. I could comment out \subsection*{} compile two times, and put \subsection*{} again and compile one more time. Then it works as should. – faramir May 25 '15 at 14:05
  • out of curiosity: what is the purpose of the empty subsection? – user36296 May 25 '15 at 14:11
  • That tells me what I need to know. I'm not a beamer guru by any stretch of the imagination, but what you want is to prohibit this section from appearing in the table of contents. In a normal LaTeX document, starring the command would work. I just tested your MWE and, after changing warsaw to Warsaw, it works as I think you want it to after two passes. Related: How to make \subsection not appear in the ToC. – Sean Allred May 25 '15 at 14:27
  • @samcarter, I have one slide on the end of section, that is not connected with previously described things, but is not wothy to mention it in the ToC or Navigation. @SeanAllred, I haven't seen any changes when I changed warsaw to Warsaw. Additional problem with the change is that I use theme that is somehow derived from the Warsaw theme (\defbeamertemplate*{headline}{uoregon theme}). – faramir May 25 '15 at 17:09
2

The following is similar to samcarter's answer but with an interface:

  • \stopnavigation turns off the beamer navigation;

  • \resumenavigation turns it back on again.

The above interface redefined \headcommand in the .nav file to temporarily do nothing, rather than write nothing to the .nav at all. It may not be ideal, but it works in your case:

\documentclass{beamer}
\let\Tiny\tiny% https://tex.stackexchange.com/q/58087/5764
\setbeamertemplate{navigation symbols}{}
\usetheme{Warsaw}
\setbeamercovered{transparent}

\makeatletter
\let\oldheadcommand\headcommand
\newcommand{\stopnavigation}{\addtocontents{nav}{\string\let\string\headcommand\string\@gobble}}
\newcommand{\resumenavigation}{\addtocontents{nav}{\string\let\string\headcommand\string\oldheadcommand}}
\makeatother

\begin{document}

\section{section 1}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\stopnavigation
\subsection*{}
\begin{frame}\end{frame}
\resumenavigation

\section{section 2}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\section{section 3}
\begin{frame}\end{frame}

\end{document}
3

Is it enough to hide the subsection?

The following idea is taken from https://tex.stackexchange.com/a/66633/36296 (There you will also finde much additional explanation).

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usetheme{Warsaw}
\setbeamercovered{transparent}

\let\origaddtocontents=\addtocontents
\def\dontaddtocontents#1#2{} % or \@gobbletwo if in \makeatletter ... \makeatother


\begin{document}

\section{section 1}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\let\addtocontents=\dontaddtocontents
\subsection{Invisible Section}
\begin{frame}this\end{frame}
\let\addtocontents=\origaddtocontents

\section{section 2}
\begin{frame}\end{frame}

\subsection{subsection 1}
\begin{frame}\end{frame}

\subsection{subsection 2}
\begin{frame}\end{frame}

\subsection{subsection 3}
\begin{frame}\end{frame}

\subsection{subsection 4}
\begin{frame}\end{frame}

\section{section 3}
\begin{frame}\end{frame}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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