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.

This question has been asked before, but for a different beamer theme. The answer there did not make it clear to me how to deal with my case, illustrated in this example (which I think is close to minimal):

\documentclass[compress]{beamer}
\usetheme{Singapore}
    \setbeamercolor{section in head/foot}{bg=white}
    \useoutertheme{miniframes}  
    % ^ dots up top
    \setbeamertemplate{navigation symbols}{}
    % ^ disable annoying footer
\newcommand{\mytoc}{
    \tableofcontents[ 
        currentsubsection, 
        hideothersubsections, 
        subsectionstyle=show/shaded/hide,
        ]} 
    \newcommand{\mytocslide}{
    \begin{frame}
        \mytoc
    \end{frame}}
\begin{document}
\section{Introduction}\subsection{}
\begin{frame}{hiya}
    yo
\end{frame}
\mytocslide
\section{Second section}\subsection{}
\begin{frame}
    yoyo
\end{frame}
\addcontentsline{toc}{section}{Section not in top nav}
\begin{frame}
    yoyoyo
\end{frame}
\end{document}

The resulting document includes the extra section in the TOC but not the nav bar (as desired), but it looks weird in the TOC.

share|improve this question
2  
Related: tex.stackexchange.com/questions/131647/… –  Frank Jan 20 at 1:53
    
See this question and the answer. \section inserts a new entry into the table of contents at the appropriate tree-level and also inserts a new entry into the navigation bars. But \section* only adds an entry in the navigation bars, not in the table of contents. –  Masroor Jan 20 at 2:06
    
When you say it 'looks weird', could you elaborate? What should it look like? It looks fine to me although it is not a link as the other entries are. Is that what you mean? –  cfr Jan 20 at 2:07
    
@cfr Sorry, I didn't think to actually include a picture. You are correct, I meant that I expected it to show up blue (like a link) and similarly spaced to the other entries. –  Frank Jan 20 at 3:11
    
@MMA Thanks, I knew that question was related (see my comment above yours :) ), but it does not solve the problem at hand. –  Frank Jan 20 at 3:11

1 Answer 1

up vote 5 down vote accepted

To achieve the same formatting as a regular section entry, you need some additional work: section entries in the ToC have a vertical extra spacing of 1.5em and they have a special color, so you need to say something like:

\addtocontents{toc}{\vskip1.5em}
\addcontentsline{toc}{section}{\protect\usebeamercolor[fg]{structure} text}

A complete example:

\documentclass[compress]{beamer}
\usetheme{Singapore}
    \setbeamercolor{section in head/foot}{bg=white}
    \useoutertheme{miniframes}  
    \setbeamertemplate{navigation symbols}{}
\newcommand{\mytoc}{
    \tableofcontents[ 
        currentsubsection, 
        hideothersubsections, 
        subsectionstyle=show/shaded/hide,
        ]} 
\newcommand{\mytocslide}{
    \begin{frame}
        \mytoc
    \end{frame}}

\begin{document}
\section{Introduction}
\subsection{}
\begin{frame}{hiya}
    yo
\end{frame}
\mytocslide

\section{Second section}
\subsection{}
\begin{frame}
    yoyo
\end{frame}

\addtocontents{toc}{\vskip1.5em}
\addcontentsline{toc}{section}{\protect\usebeamercolor[fg]{structure} Section in ToC but not in the navigation bar}

\begin{frame}
    yoyoyo
\end{frame}

\end{document}

An image of the resulting ToC, showing the new additional entry, not present in the navigation bar:

enter image description here

A more robust solution (that doesn't require manual intervention and that will even give you an hyperlink) can be achieved by defining a new command using the exact way in which sections are included in the ToC (the relevant definition can be found in the file beamerbasesection.sty):

\documentclass[compress]{beamer}
\usetheme{Singapore}
    \setbeamercolor{section in head/foot}{bg=white}
    \useoutertheme{miniframes}  
    \setbeamertemplate{navigation symbols}{}
\newcommand{\mytoc}{
    \tableofcontents[ 
        currentsubsection, 
        hideothersubsections, 
        subsectionstyle=show/shaded/hide,
        ]} 
\newcommand{\mytocslide}{
    \begin{frame}
        \mytoc
    \end{frame}}

\makeatletter
\newcommand\addsectiontotoc[1]{%
\addtocontents{toc}{%
  \protect\beamer@sectionintoc{\the\c@section}{#1}{\the\c@page}{\the\c@part}%
    {\the\beamer@tocsectionnumber}}
}
\makeatother

\begin{document}

\section{Introduction}
\subsection{}
\begin{frame}{hiya}
    yo
\end{frame}
\mytocslide

\section{Second section}
\subsection{}
\begin{frame}
    yoyo
\end{frame}

\addsectiontotoc{Section in ToC but not in the navigation bar}

\begin{frame}
    yoyoyo
\end{frame}
\end{document}
share|improve this answer
    
Thank you! I did not realize that I could customize the appearance of the TOC line. It looks like I can do both steps in one: \addcontentsline{toc}{section}{\vskip1.5em\protect\usebeamercolor[fg]{structure‌​} Conclusion} –  Frank Jan 20 at 3:09
1  
@Frank You're welcome! By the way, I added a new, more robust solution to my answer; this new possibility might be of interest for you. –  Gonzalo Medina Jan 20 at 3:19

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.