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.

I'm looking for a command to remove at will the first or the last X items of the TOC displayed in the sidebar.

My problem appear when there is too many items in the sidebar. For example, the above picture shows a small sidebar.

Small navigation sidebar

But, later in my presentation (see above), I will display so many subsections that the last TOC item disappear (and TeX issues an overfull vbox...)

Overfull navigation sidebar

Ideally, I'm wanting some advice in order to write some macro that will remove the 1 or 2 first TOC items (here Sommaire and Objectifs pédagogiques) when I am in the problematic section (Méthode ...).

I already check this question that is a little similar, but it does not solve my problem as there are always only 3 section displayed.

share|improve this question
    
You can try to use \part between each group of \sections. –  Paul Gaborit Dec 4 '12 at 14:27
1  
Not really: using \part will solve the problem of space, but will also "remove" the display of the entire TOC. Ideally, I would prefer to keep as much as possible the TOC, by "shifting" the content of the sidebar to the bottom or to the top. –  Lionel MANSUY Dec 5 '12 at 9:11
    
How about shrinking the TOC? There is available vertical space in your example that could be minimized. Of course, it won't fix the problem for extremely long TOC. Also, it looks to me that there is not difference between your frametitles and subsection titles. That's also one solution: avoid redundancy. –  pluton Dec 27 '12 at 16:12

1 Answer 1

up vote 2 down vote accepted

For information, here is what I have done to solve my problem

1/ I have defined a couple of counters

\newcounter{numsection}  % count the index of the sections
\newcounter{skipsection} % number of the section to remove at the beginning
\newcounter{lastsection} % index of the last section to display
\def\tmp@skipsection{0}  % temporary variable
\def\tmp@lastsection{0}  % temporary variable

2/ Definition of the function to set the counters; they have to be called before the \section command

\newcommand{\setskipsection}[1]{\gdef\tmp@skipsection{#1}}
\newcommand{\setlastsection}[1]{\gdef\tmp@lastsection{#1}}

3/ Installation of the hooks using \AtBeginSection command:

\AtBeginSection[]{
    \setcounter{skipsection}{\tmp@skipsection}
    \setcounter{lastsection}{\tmp@lastsection}
    \setskipsection{0}
    \setlastsection{0}
    \sectionframe
}

4/ Redefinition of the relevant template: a) reset the counter for the section index

\defbeamertemplate*{sidebar left}{modele-name}
{%
    \setcounter{numsection}{0}%
    \insertverticalnavigation{\beamer@leftsidebar}%
}

b) code for a normal section, essentially to count the index of the section

\defbeamertemplate*{section in sidebar}{modele-name}
{%
    \stepcounter{numsection}%
    \ifnum\value{numsection}>\value{skipsection}%
        % code for typesetting section name
    \fi%
}

c) code for a shaded section

\defbeamertemplate*{section in sidebar shaded}{modele-name}
{%
    \stepcounter{numsection}%
    \ifnum\value{lastsection}=0%
        \ifnum\value{numsection}=\value{skipsection}%
            % code to display the *collapsed* sections at the beginning of the sidebar
        \fi%
        \ifnum\value{numsection}>\value{skipsection}%
            % code to display a normal shaded section
        \fi%
    \else%
        \ifnum\value{numsection}=\value{skipsection}%
            % code to display the *collapsed* sections at the beginning of the sidebar
        \fi%
        \ifnum\value{numsection}>\value{skipsection}%
            \ifnum\value{numsection}<\value{lastsection}%
                % code to display a normal shaded section
            \fi%
            \ifnum\value{numsection}=\value{lastsection}%
                % code to display the *collapsed* sections at the end of the sidebar
            \fi%
        \fi%
    \fi%
}
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.