1

My goal is to show different source code versions. For readability, I prefer to have those versions on different frames, but for the organization of the presentation, it should seem like one frame. Changing the page counter can be done by \addtocounter{framenumber}{-1}.

This would be an example:

\documentclass{beamer}
\usepackage{listings}
\usepackage[english]{babel}

\usetheme{Berlin}
\setbeamertemplate{footline}[frame number]

\begin{document}

\section{Test}
\subsection{Test}

\begin{frame}[fragile]{My Code}

\begin{lstlisting}[mathescape=true]
class ClassA {
 public void methodA() {
  new ClassB().methodB1();
 }
}
 \end{lstlisting}
\end{frame}

\begin{frame}[fragile]{My Code}
\addtocounter{framenumber}{-1}

\begin{lstlisting}[mathescape=true]
class ClassA {
 public void methodA() {
  new ClassB().methodC1();
 }
}
 \end{lstlisting}
\end{frame}

\begin{frame}[fragile]{Final Remarks}
...
\end{frame}

\end{document}

But I could not find a solution for changing the navigation. Setting the counter with \setcounter{subsection}{1} did not set the correct counter, since this seems to set the subsection, not the frame number in the subsection. Is there any way of finding a counter, e.g. in a list of all defined counters?

Hide some slides from the miniframes navigation in beamer is very similar to the solution, but if I use this, the current navigation circle is not highlighted. Is there a solution where the circle for the current (last) frame stays highlighted, but there is no circle added in the navigation?

2

Messing with the miniframe navigation is tricky, I would not do it unless it is really necessary.

Instead simply use only a single frame and split it in several overlays:

\documentclass{beamer}
\usepackage{listings}
\usepackage[english]{babel}

\usetheme{Berlin}
\setbeamertemplate{footline}[frame number]

\begin{document}

\section{Test}
\subsection{Test}

\begin{frame}[fragile]{My Code}

\begin{onlyenv}<1>
\begin{lstlisting}[mathescape=true]
class ClassA {
 public void methodA() {
  new ClassB().methodB1();
 }
}
 \end{lstlisting}
\end{onlyenv}

\begin{onlyenv}<2>
\begin{lstlisting}[mathescape=true]
class ClassA {
 public void methodA() {
  new ClassB().methodC1();
 }
}
 \end{lstlisting}
\end{onlyenv}
\end{frame}

\begin{frame}[fragile]{Final Remarks}
...
\end{frame}

\end{document}

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.