4

I was wondering how I can customize the sidebar such that it only shows the current section and subsections that I am currently presenting and how can I remove the navigation bar from the title slide.

1
  • 1
    Which beamer theme(s) are you using? Can you please add to your question a little document showing the relevant settings? Jul 12, 2014 at 22:11

1 Answer 1

5

Hiding other subsections is easy: it's enough to use the hideothersubsections option (either for the theme or for the sidebar outer theme). Hiding other sections is not so simple; it involves a redefinition of \insertverticalnavigation as implemented in beamerbasenavigation.sty. Hiding the navigation bar from the title frame can be achieved using the plain option for the frame. The following example code contains the required code:

\documentclass{beamer}
\usetheme[hideothersubsections]{PaloAlto}

\makeatletter
\def\insertverticalnavigation#1{%
  \vbox{%
    \def\sectionentry##1##2##3##4##5{%
      \ifnum##5=\c@part%
      \def\insertsectionhead{##2}%
      \def\insertsectionheadnumber{##1}%
      \def\insertpartheadnumber{##5}%
      \hbox{{%
        \usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
          \hyperlink{Navigation##3}{%
          \ifnum\c@section=##1%
            \ifnum\c@subsection=0\relax%
              {\usebeamertemplate{section in sidebar}}%
            \else%
              \ifx\beamer@nav@css\beamer@hidetext%
                {\usebeamertemplate{section in sidebar}}%
              \else%
                {\usebeamertemplate{section in sidebar shaded}}%
              \fi%
            \fi%
          \else
            %{\usebeamertemplate{section in sidebar shaded}}%
          \fi}}}%
      \beamer@currentsubsection=0\relax\fi}%
    \def\slideentry##1##2##3##4##5##6{}%
    \def\beamer@subsectionentry##1##2##3##4##5{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsectionhead{##5}%
       \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
          \hyperlink{Navigation##4}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=0\relax%
                {\usebeamertemplate{subsection in sidebar}}%
              \else%
                {\usebeamertemplate{subsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsection in sidebar shaded}}%
          \fi}}}%
      }%
      \fi}%
    \def\beamer@subsubsectionentry##1##2##3##4##5##6{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsubsectionheadnumber{##3}%
      \def\insertsubsubsectionhead{##6}%
      \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
          \hyperlink{Navigation##5}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=##4%
                {\usebeamertemplate{subsubsection in sidebar}}%
              \else
                {\usebeamertemplate{subsubsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsubsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsubsection in sidebar shaded}}%
          \fi}}}%
      }%
      \fi}%
    %\beamer@currentsubsection=0\relax%
    \dohead%
  }%
}
\makeatother

\title{The Title}
\author{The Author}
\institute{The Institute}

\begin{document}

\begin{frame}[plain] 
\maketitle
\end{frame}

\section{Test section one}
\begin{frame} test frame for section one\end{frame}
\subsection{Test subsection one one}
\begin{frame} test frame for section one\end{frame}
\subsection{Test subsection one two}
\begin{frame} test frame for section one\end{frame}

\section{Test section two}
\begin{frame} test frame for section two\end{frame}
\subsection{Test subsection two one}
\begin{frame} test frame for section two\end{frame}
\subsection{Test subsection two two}
\begin{frame} test frame for section two\end{frame}

\end{document}

enter image description here

5
  • If hiding sections is quite hard, is there a way to make the navigation sidebar adjust to when I get to future sections. Basically I have way too many sections and subsections and not all of them are visible.
    – emka
    Jul 12, 2014 at 23:41
  • @emka I don't understand your question. Please elaborate. Besides, even though hiding sections is a little harder my answer already shows how to do it. Jul 12, 2014 at 23:43
  • I have about one dozen sections in my presentation and each section has anywhere between 1 and 5 subsections. The navigation sidebar does not show all of the sections. I am using the PaloAlto theme.
    – emka
    Jul 13, 2014 at 0:00
  • @emka Did you try my code? Using it, when you are, say, in section 3 just that section and its subsections will show in the navigation bar. Isn't that what you wanted? Jul 13, 2014 at 0:15
  • Thanks! I really appreciate this. The code seems quite complex.
    – emka
    Jul 13, 2014 at 0:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .