# Align Text in Navigation

I have a beamer template with following code:

\begin{beamercolorbox}[wd=.24\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfill\hskip-17ex\insertsectionnavigation{.22\paperwidth}\vfill\hfill}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.24\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.18\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.038\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\hspace*{0.6cm}\pgfuseimage{UT}\vfil}%
\end{beamercolorbox}%


Thats the header.... My problem is, that the text of the Navigation doenst start left align. I want the text all the way to the left in the box. The text always starts always in the middle of the box and kinda types backwards. Could anyone help me please?

-

## 1 Answer

You might want to use \insertsubsection instead of \insertsubsectionnavigation{⟨width⟩} which according to the manual

Inserts a vertical navigation bar containing all subsections of the current section, with the current subsection highlighted.

This bar adds additional space to the left and right of the (sub)section. It works the same way with \insertsection versus \insertsectionnavigation{⟨width⟩}.

Please compare with this example:

\documentclass{beamer}

\makeatletter
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[wd=.24\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfill\insertsection\vfill\hfill}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.24\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsection\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.038\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\hspace*{0.6cm}\rule{2cm}{0.5cm}\vfil}%
\end{beamercolorbox}%
}
\makeatother

\begin{document}
\section{A section}
\subsection{A subsection}
\begin{frame}{A show frame}
just text here
\end{frame}
\end{document}


Comments: Now that the text directly starts at the frame border, you might want to insert a \hspace*{1em}.

I removed \hskip-17ex in order to render the text within the beamercolorbox and used a rule instead of the UT image.

Update:

Alternatively, you can redefine the templates of \insertsectionnavigationand \insertsubsectionnavigation from beamerbasenavigation.sty for a reduction of the added horizontal space and \RaggedRight text (using the ragged2e package).

\usepackage{ragged2e}

\makeatletter
\renewcommand\insertsectionnavigation[1]{%
\hbox to #1{%
\vbox{{\usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
\vskip0.5ex%
\def\slideentry##1##2##3##4##5##6{}%
\def\sectionentry##1##2##3##4##5{%
\ifnum##5=\c@part%
\def\insertsectionhead{##2}%
\def\insertsectionheadnumber{##1}%
\def\insertpartheadnumber{##5}%
\setbox\beamer@tempbox=\hbox{\RaggedRight% added for flushed left text
\hyperlink{Navigation##3}{\hbox to #1{%
\hskip0.5ex% adjusted from 0.3 cm
\ifnum\c@section=##1%
{\usebeamertemplate{section in head/foot}}%
\else%
{\usebeamertemplate{section in head/foot shaded}}%
\fi\hskip0.5ex}}}% adjusted from 0.3 cm
\ht\beamer@tempbox=1.6875ex\dp\beamer@tempbox=0.75ex%
\box\beamer@tempbox\fi}%
\dohead\vskip0.5ex}}\hfil}}
\renewcommand\insertsubsectionnavigation[1]{%
\hbox to #1{%
\vbox{{%
\usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
\vskip0.5625ex%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\beamer@currentsubsection=##2%
\def\insertsubsectionhead{##5}%
\def\insertsectionheadnumber{##1}%
\def\insertsubsectionheadnumber{##2}%
\def\insertpartheadnumber{##6}%
\setbox\beamer@tempbox=\hbox{\RaggedRight\beamer@link(##4){% added for flushed left text
\hbox to #1{\hskip0.5ex% adjusted from 0.3 cm
\ifnum\c@subsection=##2%
{\usebeamertemplate{subsection in head/foot}}%
\else%
{\usebeamertemplate{subsection in head/foot shaded}}%
\fi\hfil\hskip0.5ex}}}% adjusted from 0.3 cm
\ht\beamer@tempbox=1.6875ex\dp\beamer@tempbox=0.75ex%
\box\beamer@tempbox\fi\fi\fi}%
\dohead\vskip0.5625ex}\hfil}}}
% headline template
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[wd=.24\paperwidth]{section in head/foot}%
\insertsectionnavigation{.22\paperwidth}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.24\paperwidth]{section in head/foot}%
\insertsubsectionnavigation{.18\paperwidth}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.038\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\hspace*{0.6cm}\rule{2cm}{0.5cm}\vfil}%
\end{beamercolorbox}%
}
\makeatother

-
 But the problem is, that its shows just the actual Section which is active. I wanna see the other ones too... – ben Sep 19 '12 at 15:17 @ben: please see my updated answer! – hakaze Sep 19 '12 at 21:44 If I add your code to my *.sty File I'll get an error: ! Undefined control sequence. l.171 \ifbeamer @compress ? – ben Sep 23 '12 at 11:34 @ben did you use the enclosing \makeatletter/\makeatother commands? Is your LaTeX-system up-to-date? – hakaze Sep 25 '12 at 9:29