導航符號中指向下一節的超連結在最後一節中跳到最後一幀

導航符號中指向下一節的超連結在最後一節中跳到最後一幀

在此投影機文件中,在最後一節中:

在此輸入影像描述

如果您單擊“下一部分”,理想的結果將是停在這裡,因為這是最後一部分。但是,如果您單擊“下一部分”,您將轉到最後一部分中的最後一幀:

在此輸入影像描述

有沒有辦法達到理想的結果(即當我們在最後一節時,如果我們單擊“下一節”,不要跳轉)。

代碼:

\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}

相關內容