[Tex/LaTex] Remove compress option from beamer between sections (miniframes)

beamerformattingmini-framesnavigation

I'm putting together some slides using the Szeged theme. I'm omitting frame titles, and instead using subsection titles to display the desired frame information. In the first section, I would like to have all of the navigation dots on one row, however in the second section I would like the navigation dots to be displayed in two rows. The code below results in the navigation bar looking correct for section 1, but incorrect for section 2. Removing "compress" after \documentclass results in the navigation bar looking correct for section 2, but incorrect for section 1. Ideally I would like to apply the compress option from \documentclass to only the first section.

\documentclass[compress, usepdftitle=false]{beamer}
\mode<presentation>
\usetheme{Szeged}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[english]{babel}
\usepackage{pgf}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\begin{document}

\section{Section 1}
\subsection{Some Title}
\begin{frame}
...
\end{frame}

\subsection{Some Different Title}
\begin{frame}
...
\end{frame}


\section{Section 2}
\subsection{This is a line graph}
\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}


\subsection{This is a bar chart}
\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\end{document}

Edit – An ideal solution would be to display frame titles in the space reserved for subsection titles, however I have not found how to do that. I'm sure this is possible by making a custom theme, but that is beyond the scope of my latex expertise and I unfortunately don't have the time to learn currently. If this is possible without modifying the .sty file, then that would certainly answer my question.

Best Answer

You can define your own macros \compresson and \compressoff to control for which sections the compress option is used:

\makeatletter
\newcommand*{\compresson}{\addtocontents{nav}{\protect\headcommand{\protect\beamer@compresstrue}}}
\newcommand*{\compressoff}{\addtocontents{nav}{\protect\headcommand{\protect\beamer@compressfalse}}}
\makeatother

With these macros, you can achieve the desired output like this:

\documentclass[usepdftitle=false]{beamer}
\mode<presentation>
\usetheme{Szeged}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[english]{babel}
\usepackage{pgf}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\makeatletter
\newcommand*{\compresson}{\addtocontents{nav}{\protect\headcommand{\protect\beamer@compresstrue}}}
\newcommand*{\compressoff}{\addtocontents{nav}{\protect\headcommand{\protect\beamer@compressfalse}}}
\makeatother

\begin{document}

\compresson

\section{Section 1}
\subsection{Some Title}
\begin{frame}
...
\end{frame}

\subsection{Some Different Title}
\begin{frame}
...
\end{frame}

\compressoff

\section{Section 2}
\subsection{This is a line graph}
\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\subsection{This is a bar chart}
\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\begin{frame}
...
\end{frame}

\end{document}

headline for the example code, with section 1 compressed and section 2 uncompressed