如何在 beamer 中添加内容幻灯片的快捷方式?

如何在 beamer 中添加内容幻灯片的快捷方式?

我需要在每张幻灯片上设置指向内容幻灯片的快捷方式,该幻灯片位于演示文稿的末尾。

我试图这样做:

\documentclass{beamer}
\usepackage{hyperref}
\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \hyperref[sec:main-content]{Content}
        \end{beamercolorbox}%

        \begin{beamercolorbox}[wd=.9\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            %   \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertframenumber{} \hspace*{2ex}  / \hspace*{2ex} \inserttotalframenumber
            \hspace*{2ex} 
        \end{beamercolorbox}}%
        \vskip0pt%
    }
    \makeatother


\begin{document}
    \begin{frame}{Main}
        Main
    \end{frame}

    \section{First}
    \begin{frame}{First}
        First
    \end{frame}

    \section{Second}
    \begin{frame}{Second}
        Second
    \end{frame}

    \section*{Content}
    \label{sec:main-content}
    \begin{frame}{Content}
        \tableofcontents[hideallsubsections]
    \end{frame}
\end{document}

但这个方案并没有达到我想要的效果。因为点击Content链接后它并没有将我发送到最后一张幻灯片。

答案1

代替

\hyperref[sec:main-content]{Content}

使用

\hyperlink{sec:main-content}{Content}

一个完整的例子(顺便说一下,不需要hyperref使用显式加载beamer):

\documentclass{beamer}

\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \hyperlink{sec:main-content}{Content}
        \end{beamercolorbox}%

        \begin{beamercolorbox}[wd=.9\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            %   \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertframenumber{} \hspace*{2ex}  / \hspace*{2ex} \inserttotalframenumber
            \hspace*{2ex} 
        \end{beamercolorbox}}%
        \vskip0pt%
    }
    \makeatother


\begin{document}
    \begin{frame}{Main}
        Main
    \end{frame}

    \section{First}
    \begin{frame}{First}
        First
    \end{frame}

    \section{Second}
    \begin{frame}{Second}
        Second
    \end{frame}

    \section*{Content}
    \label{sec:main-content}
    \begin{frame}{Content}
        \tableofcontents[hideallsubsections]
    \end{frame}
\end{document}

您可以使用可选参数来frame设置标签:

\documentclass{beamer}

\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \hyperlink{sec:main-content}{Content}
        \end{beamercolorbox}%

        \begin{beamercolorbox}[wd=.9\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            %   \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertframenumber{} \hspace*{2ex}  / \hspace*{2ex} \inserttotalframenumber
            \hspace*{2ex} 
        \end{beamercolorbox}}%
        \vskip0pt%
    }
    \makeatother


\begin{document}
    \begin{frame}{Main}
        Main
    \end{frame}

    \section{First}
    \begin{frame}{First}
        First
    \end{frame}

    \section{Second}
    \begin{frame}{Second}
        Second
    \end{frame}

    \section*{Content}
    \begin{frame}[label={sec:main-content}]
    \frametitle{Content}
        \tableofcontents[hideallsubsections]
    \end{frame}
\end{document}

相关内容