1

I'm making a presentation in Warsaw theme of Beamer with headline structure as follows:

\setbeamertemplate{headline}{%
\leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
    \end{beamercolorbox}%
  }
}

How to display only three sections or like so, previous-current-after sections, with highlighting current section ? As I've a large number of sections ~10, all of them can not be displayed in headline. Please suggest.

  • I think that this kind of headline intention is to show audience in which point of the presentation you are. If you suppress part of this information, headline is useless. Did you considered to change to a sidebar theme? – Ignasi Apr 28 '15 at 12:14
  • Thank you Ignasi for your reply. If you are asking about using themes like Bergen or Marburg , then it is the same reason I did not used default Warsaw theme; i.e. I need more space in slides to add images. And these themes consume space from it. So I used above type of headline , so that it can be confined within a line with less use of space. – shreekant Apr 28 '15 at 13:55
  • Have a look at this answer tex.stackexchange.com/a/54956/36296 – user36296 Apr 28 '15 at 15:06
  • Or at this tex.stackexchange.com/questions/96824/… – user36296 Apr 28 '15 at 15:07
  • Thank you samcarter for your reply. This solves the problem little bit :) Is it possible to keep it as line at top instead of generating bands at top ? – shreekant Apr 28 '15 at 15:33
1
\documentclass{beamer}

\usetheme{Warsaw}

\AtBeginSection[]{\label{sec:\thesection}}

\usepackage{totcount}
\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
  \pretocmd{\section}{\refstepcounter{totalsection}}{}{}%
}%

\newcounter{start}
\newcounter{stop}

\usepackage{pgffor}

\setbeamercolor{section in head/foot}{fg=white}
\setbeamercolor{section in head/foot shaded}{fg=white!60!bg}

\setbeamertemplate{headline}{%
\leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
        \ifnum\value{section}>0%
            \quad
            \setcounter{start}{\value{section}}
                \setcounter{stop}{\value{section}}
                \ifnum\value{section}>1
                    \addtocounter{start}{-1}
                \fi
                \ifnum\value{section}<\totvalue{totalsection}
                    \addtocounter{stop}{1}
                \fi     
                \foreach \i in {\thestart,...,\thestop}{%
                    \ifnum\i=\value{section}
                        \usebeamercolor[fg]{section in head/foot}
                    \else   
                        \usebeamercolor[fg]{section in head/foot shaded}
                    \fi
                    \hfill\hyperlink{sec:\i}{\nameref{sec:\i}}
                }
                \hfill\quad
            \fi
    \end{beamercolorbox}%
  }
}



\begin{document}

\section{test1}\begin{frame}abc\end{frame}  
\section{test2}\begin{frame}abc\end{frame}  
\section{test3}\begin{frame}abc\end{frame}  
\section{test4}\begin{frame}abc\end{frame}  
\section{test5}\begin{frame}abc\end{frame}  
\section{test6}\begin{frame}abc\end{frame}  
\section{test7}\begin{frame}abc\end{frame}  
\section{test8}\begin{frame}abc\end{frame}  
\section{test9}\begin{frame}abc\end{frame}  
\section{test10}\begin{frame}abc\end{frame} 
\section{test11}\begin{frame}abc\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.