I've ported from PowerPoint my university's template in Beamer, and added some code to display sections (and subsections when they exists) in the header.

This is the code snippet I've put in the headline template for this purpose:

\begin{beamercolorbox}[wd=0.6\paperwidth,ht=0.1\beamer@PoliMI@headheight]{section in head/foot}%
    \usebeamerfont{section in head/foot}\par%

However, when "exiting" from subsection (issuing \subsection*{}), the dash after the section name is still printed.

How can I test if the subsection name is void?
As an alternative, how can I make \insertsubsection empty?



\setbeamertemplate{navigation symbols}{}

  \begin{beamercolorbox}[wd=0.6\paperwidth,ht=0.016\paperwidth]{section in head/foot}%
    \usebeamerfont{section in head/foot}%


In the third frame, only "aaa" must show up, and not "aaa -".

UPDATE: If subsection is not yet defined, \insertsubsection is empty, whereas if a \subsection*{} is issued, the macro is expanded in \expandafter \hyperlink \subsectionlink, either the subsection is empty (\insertsubsectionhead expands to \hyperlink {Navigation\the \c@page }{}) or not (\insertsubsectionhead expands to \hyperlink {Navigation\the \c@page }{bbb} in the second frame).

  • 1
    Welcome to TeX.SE. Thanks for posting the problem code snippets. However you should also post a fully compilable MWE that reproduces the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. It is still going to be useful in testing that a proposed solution actually worked. Oct 1, 2014 at 8:33
  • @PeterGrill: please see edited question.
    – Astrinus
    Oct 1, 2014 at 9:05

3 Answers 3


I have replaced the code snippet with


and IT WORKS!!!
Unfortunately needs the etoolbox package to be loaded...



also works and does not require etoolbox.
I don't know if this is the "cleaner" solution.


I can't comment but I had issues with the 2nd solution of @Astrinus and wanted to share it nonetheless.

\subsecname is not deleted by default when a new section is created. Replacing it with \insertsubsectionhead worked to solve it for me.

        - \insertsubsectionhead%

I had issues with recognizing end of subsection by:


Limiting the SubSection in braces made it working:

\subsection{SubSection Title}
<subsection frames>
<other frames>

The condition correctly differed between frames inside and outside that SubSection

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.