# How to center align the section navigation bar in the headline

I have a section navigation bar in my headline, and I want it to show the sections center aligned. Although, the section navigation bar is right aligned, I tried to position it in the center by setting the position manually using the following code:

\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\end{beamercolorbox}%
}
}


With the above definition of the headline, here is the snap of one of the frames:

How can I get the text (the sections) in the section navigation bar center aligned?

• Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – ebosi Jun 2 '16 at 8:31
• Can you please post a complete minimal working example instead of a code fragment? – user36296 Jun 2 '16 at 9:19
• please see the edits @samcarter – user107054 Jun 3 '16 at 7:39

I added two \hfill around \usebeamertemplate{section in head/foot} to make them centred.

\documentclass{beamer}

\usetheme{Berlin}

\leavevmode%
\hbox{%
\end{beamercolorbox}%
}
}

\makeatletter
\hbox to #1{%
\vskip0.5625ex%
\def\slideentry##1##2##3##4##5##6{}%
\def\sectionentry##1##2##3##4##5{%
\ifnum##5=\c@part%
\setbox\beamer@tempbox=\hbox{%
\hskip0.3cm%
\ifnum\c@section=##1%
\else%
\fi\hskip0.3cm}}}%
\ht\beamer@tempbox=1.6875ex\dp\beamer@tempbox=0.75ex%
\box\beamer@tempbox\fi}%