我尝试生成带有可点击链接的部分目录。我发现这,但不幸的是它不生成超链接。我发现了以下生成可点击链接的建议,但所有这些链接都引用了 parttoc 本身。
\documentclass{beamer}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\newcommand{\dummyFrame}[1][1]{\begin{frame}{Test}\blindtext[#1]\end{frame}}
\usepackage{hyperref}
% for the list of parts
\makeatletter
\AtBeginPart{%
\addtocontents{toc}{%
\protect\beamer@partintoc{\the\c@part}{\beamer@partnameshort}{\the\c@page}%
}%
% \setcounter{framenumber}{0}
\frame{\partpage}
}
%% number, shortname, page.
\providecommand\beamer@partintoc[3]{%
\ifnum\c@tocdepth=-1\relax
% requesting onlyparts.
\makebox[6em]{Einheit #1:} \textcolor{green!30!blue}{\hyperlink{#2}{#2}}
\par
\fi
}
\define@key{beamertoc}{onlyparts}[]{%
\c@tocdepth=-1\relax
}
\makeatother%
\begin{document}
\begin{frame}{Inhaltsübersicht}
\tableofcontents[onlyparts]
\end{frame}
\part{MyPart One}
\dummyFrame
\part{MyPart Two}
\dummyFrame
\dummyFrame
\part{MyPart Three}
\dummyFrame
\dummyFrame
\end{document}
我怎样才能让这些链接指向正确的框架?提前感谢任何建议
答案1
您可以为零件框架添加标签,然后将其用作链接目标:
\documentclass{beamer}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\newcommand{\dummyFrame}[1][1]{\begin{frame}{Test}\blindtext[#1]\end{frame}}
\usepackage{hyperref}
% for the list of parts
\makeatletter
\AtBeginPart{%
\addtocontents{toc}{%
\protect\beamer@partintoc{\the\c@part}{\hyperlink{part-\thepart}{\beamer@partnameshort}}{\the\c@page}%
}%
% \setcounter{framenumber}{0}
\frame[label=part-\thepart]{\partpage}
}
%% number, shortname, page.
\providecommand\beamer@partintoc[3]{%
\ifnum\c@tocdepth=-1\relax
% requesting onlyparts.
\makebox[6em]{Einheit #1:} \textcolor{green!30!blue}{#2}
\par
\fi
}
\define@key{beamertoc}{onlyparts}[]{%
\c@tocdepth=-1\relax
}
\makeatother%
\begin{document}
\begin{frame}{Inhaltsübersicht}
\tableofcontents[onlyparts]
\end{frame}
\part{MyPart One}
\dummyFrame
\part{MyPart Two}
\dummyFrame
\dummyFrame
\part{MyPart Three}
\dummyFrame
\dummyFrame
\end{document}