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.

My navigation bar at the top of each slide (that links to each section) has too many sections. I would like to keep the bar and keep each section but I would like to wrap it i.e. have it on two lines.

Is that possible?

I am using compress and I am using progressbar as a theme.

share|improve this question
    
Please indicate which beamer theme you use at present. Also, have you tried using the class option compress, as in \documentclass[compress]{beamer}? With this option, beamer will try to make all navigation bars "as small as possible." –  Mico Feb 22 '12 at 2:45
    
Edited to add this information. –  iKs Feb 22 '12 at 4:26
add comment

1 Answer

up vote 3 down vote accepted

You could redefine the \insertsectionnavigationhorizontal command and wrap the sections with a parbox.

Here is a quick & dirty example of it could be done in general:

\makeatletter
\def\insertsectionnavigationhorizontal#1#2#3{%
 \hbox to #1{{%
   \def\slideentry##1##2##3##4##5##6{}%
   #2\hskip.3cm%
   \newdimen\tmp@parbox%
   \setlength\tmp@parbox{#1}%
   \addtolength\tmp@parbox{-.6cm}%
   \parbox{\tmp@parbox}{\raggedleft%
     \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
     \setbox\beamer@sectionbox=\hbox{}%
     \ht\beamer@sectionbox=1.875ex%
     \dp\beamer@sectionbox=0.75ex%
     \hskip-1.875ex plus-1fill\dohead%
     \box\beamer@sectionbox}\hfil\hskip.3cm%
     #3}}}
\makeatother

Here is a complete example for the progressbar theme, with increased headline height.

\documentclass[compress]{beamer}

\usetheme{progressbar}
\progressbaroptions{headline=sections}

\makeatletter
\def\insertsectionnavigationhorizontal#1#2#3{%
  \hbox to #1{{%
    \def\slideentry##1##2##3##4##5##6{}%
    #2\hskip.3cm%
    \newdimen\tmp@parbox%
    \setlength\tmp@parbox{#1}%
    \addtolength\tmp@parbox{-.6cm}%
    \parbox{\tmp@parbox}{\raggedleft%
      \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
      \setbox\beamer@sectionbox=\hbox{}%
      \ht\beamer@sectionbox=1.875ex%
      \dp\beamer@sectionbox=0.75ex%
      \hskip-1.875ex plus-1fill\dohead%
      \box\beamer@sectionbox}\hfil\hskip.3cm%
      #3}}}

\setbeamertemplate{headline}
{%
  \edef\tempa{sections}
  \ifx\progressbar@headline\tempa
  \leavevmode%
  \begin{beamercolorbox}[ignorestructure.bg=true,wd=\paperwidth,ht=8ex,dp=1.125ex]{structure.fg}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{}%\hskip0pt plus1filll}{}%
    \vspace*{0mm}
  \end{beamercolorbox}%
  \else
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=4ex,dp=1.125ex]{structure.fg}%
  \end{beamercolorbox}%
  \fi
}

\makeatother

\begin{document}

\section{First very long section name}
\section{Second very long section name}
\section{Third very long section name}
\section{Fourth very long section name}
\section{Fifth very long section name}

\begin{frame}{Title}
Content
\end{frame}

\end{document}
share|improve this answer
    
I'm not sure I understand what you wrote. I tried incorporating your example into my code and got a 'weird error'. Is there perhaps a simpler way to make the text on the sections wrap around? –  iKs Feb 22 '12 at 4:25
1  
@iKs Try including the code in the preamble by putting the code between \makeatletter ..... \makeatother. –  percusse Feb 22 '12 at 9:05
    
Sry, forgot to mention this. Added the makeat stuff to the example. The example is the original beamer implementation with an added parbox including basic width calculation. –  ejoerns Feb 22 '12 at 12:28
    
Can you please complete your code into a full working example with one/two dummy frames? It's precisely the cases as above in the comments that we are trying to avoid. Besides, people who ends up on this page directly from Google might have none to little initial (La)TeX knowledge. –  percusse Feb 24 '12 at 11:05
add comment

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.