# hyperlink to previous section in navigation symbols

I have declared a series of \hyperlinksections:

\documentclass{beamer}
\usepackage[]{hyperref}

\setbeamertemplate{footline}{%
\vspace*{0.2cm}%
}

\begin{document}

\section{sec1}
\begin{frame}%{ss}
1st section/ page 1 out of 1
\end{frame}

\begin{frame}
1st section/ page 2 out of 2
\end{frame}

\begin{frame}[label=Detailed_Analysis]
Detailed Analysis
\end{frame}

\section{sec2}
\begin{frame}
2nd section
\end{frame}

\section{sec3}
\begin{frame}
3rd section
\end{frame}

\end{document}


The hyperlinks "Back to start", "Back to section start", "Detailed Analysis", "Next section" work, but the "Previous section" hyperlink does not jump to the previous section, but to the "Detailed Analysis" section, i.e:

When in the 2nd Section:

if I click on "Previous Section", it goes to the "Detailed Analysis" section instead of the "1st Section":

Is there a way to make the Previous section hyperlink to work ?

Update: Using @samcarter answer, there is this issue: When in the last section:

If you click on "Next Section", the desirable result would be to stop here, since this is the last section. However, if you click on "Next Section", you will go to the last frame inside this last section:

Is there a way to achieve the desirable result (i.e. When we are in the last section, if we click on "Next Section", don't jump).

Code:

\documentclass{beamer}

\AtBeginSection[]{\label{sec:\thesection}}
\newcounter{prevsec}

\title{Some Title}

\setbeamertemplate{footline}{%
\setcounter{prevsec}{\thesection}
\ifnum\theprevsec>1
\fi
\vspace*{0.2cm}%
}

\begin{document}

\section{sec1}
\begin{frame}%{ss}
1st section/ page 1 out of 1
\end{frame}

\begin{frame}
1st section/ page 2 out of 2
\end{frame}

\begin{frame}[label=Detailed_Analysis]
Detailed Analysis
\end{frame}

\section{sec2}
\begin{frame}
2nd section
\end{frame}

\section{sec3}
\begin{frame}
3rd section
\end{frame}

\begin{frame}
More content on the 3rd section
\end{frame}

\begin{frame}
Even More content on the 3rd section
\end{frame}

\end{document}


I guess the problem is that \hyperlinksectionendprev jumps to the last frame of the previous section whereas you seem to want to go to the first frame of the previous section.

\documentclass{beamer}

\AtBeginSection[]{\label{sec:\thesection}}
\newcounter{prevsec}

\title{Some Title}

\setbeamertemplate{footline}{%
\setcounter{prevsec}{\value{section}}
\ifnum\value{prevsec}>1
\fi
\vspace*{0.2cm}%
}

\begin{document}

\section{sec1}
\begin{frame}%{ss}
1st section/ page 1 out of 1
\end{frame}

\begin{frame}
1st section/ page 2 out of 2
\end{frame}

\begin{frame}[label=Detailed_Analysis]
Detailed Analysis
\end{frame}

\section{sec2}
\begin{frame}
2nd section
\end{frame}

\section{sec3}
\begin{frame}
3rd section
\end{frame}
\end{document}

• Thanks a lot for your answer. However, I have noticed some issue with the "Next section" link - please see updated question. Thanks again – DavidC. Feb 10 '18 at 15:09
• @DavidC. Your new problem is unrelated to your previous question. Please ask a new question. – user36296 Feb 10 '18 at 15:12
• @ samcarter Ok. Please see: tex.stackexchange.com/questions/414661/… – DavidC. Feb 10 '18 at 15:27