导航符号中指向下一节的超链接在最后一节时跳转到最后一帧

导航符号中指向下一节的超链接在最后一节时跳转到最后一帧

在此 beamer 文档中,最后一节中:

在此处输入图片描述

如果你点击“下一节”,理想的结果是停在这里,因为这是最后一节。但是,如果你点击“下一节”,你将转到最后一节中的最后一帧:

在此处输入图片描述

有没有办法实现理想的结果(即当我们在最后一节时,如果我们点击“下一节”,就不要跳转)。

代码:

\documentclass{beamer}

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

\title{Some Title}

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{footline}{%
        \setcounter{prevsec}{\thesection}
        \ifnum\theprevsec>1
            \addtocounter{prevsec}{-1}
        \fi
    \quad\hyperlinkpresentationstart{\beamerreturnbutton{Back to start}}%
    \quad\hyperlinksectionstart{\beamerreturnbutton{Back to section start}}%
    \quad\hyperlink{Detailed_Analysis}{\beamergotobutton{Detailed Analysis}}%
    \quad\hyperlinksectionstartnext{\beamerskipbutton{Next section}}%
    \quad\hyperlink{sec:\theprevsec}{\beamerskipbutton{previous section}}%
    \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}

答案1

以下代码将禁用最后一节中的超链接。它至少需要 2 次编译。

\documentclass{beamer}

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

\usepackage{totcount}
\regtotcounter{section}

\title{Some Title}

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{footline}{%
    \setcounter{prevsec}{\thesection}
    \ifnum\value{prevsec}>1
       \addtocounter{prevsec}{-1}
    \fi
    \quad\hyperlinkpresentationstart{\beamerreturnbutton{Back to start}}%
    \quad\hyperlinksectionstart{\beamerreturnbutton{Back to section start}}%
    \quad\hyperlink{Detailed_Analysis}{\beamergotobutton{Detailed Analysis}}%
    \ifnum\value{section}<\totvalue{section}%
        \quad\hyperlinksectionstartnext{\beamerskipbutton{Next section}}%
    \else%
        \quad \beamerskipbutton{Next section}%
    \fi%
    \quad\hyperlink{sec:\theprevsec}{\beamerskipbutton{previous section}}%
    \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}

相关内容