我使用的是简化版的导航符号栏,其中仅包含\insertslidenavigationsymbol
。我的演示文稿仅显示帧编号(而不是幻灯片编号),因为我使用了许多叠加层,幻灯片数量变得太多。问题是,如果公众要求我转到特定的帧编号(因为这是他们将看到的编号),那么导航按钮不会带我到我想要去的帧。
是否有办法自定义\insertslidenavigationsymbol
选项,以便它带我到帧编号而不是幻灯片编号?
在以下示例中,您将看到,如果您使用导航符号转到幻灯片 3,它将带您到第 2 帧中的第 3 页(我想这是预期的行为)。但是,我希望它转到第 3 帧而是。有什么想法吗?我试过,\insertframenavigationsymbol
但那个只允许我转到上一帧/下一帧,而不是特定的帧号。
\documentclass[compress]{beamer}
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{\insertslidenavigationsymbol}
{
\defbeamertemplate{footline}{frame number and last}{%
\usebeamercolor[fg]{page number in head/foot}%
\usebeamerfont{page number in head/foot}%
\hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}
\setbeamertemplate{footline}[frame number and last]{}
\begin{document}
\begin{frame}{This is frame 1}
\onslide<1-2>{Some text\\}
\onslide<2>{\invisible<1>{
Some more text}}
\end{frame}
\begin{frame}{This is frame 2}
This is frame 2
\end{frame}
\begin{frame}{This is frame 3}
This is frame 3
\end{frame}
\end{document}
答案1
以下解决方案使用 JavaScript 跳转到指定的框架。首先记住每个框架的起始页码(在宏中\FrPg@List
)。在文档末尾,这些数据被写为 JavaScript 对象FrameList
。还GoToFrame
定义了一个函数,首先询问用户他想要访问的框架。在对答案进行一些验证后,计算页码,并根据 beamer 为每个页面设置的目标名称(Navigation
+ 页码)查看框架。如果用户使用的框架号小于第一帧,则选择第一页。如果框架号太大,则使用最后一帧的起始页。
\documentclass[compress]{beamer}
\usepackage{atbegshi}
\usepackage{ltxcmds}
\usepackage{atveryend}
\makeatletter
\def\FrPg@List{}
\def\FrPg@Max{-2147483647}
\AtBeginShipout{%
\ifnum\FrPg@Max<\value{framenumber}%
\xdef\FrPg@Max{\the\value{framenumber}}%
\fi
\ltx@IfUndefined{FrPg@\number\value{framenumber}}{%
\expandafter
\xdef\csname FrPg@\number\value{framenumber}\endcsname{%
\number\value{page}%
}%
\ifx\FrPg@List\ltx@empty
\xdef\FrPg@List{%
\number\value{framenumber}:\number\value{page}%
}%
\else
\xdef\FrPg@List{%
\FrPg@List
,\number\value{framenumber}:\number\value{page}%
}%
\fi
}{}%
}
\def\FrPg@Script{FrameNavigation}
\AtVeryEndDocument{%
\immediate\pdfobj{(%
var FrameList={\FrPg@List};%
var FrameMax=\FrPg@Max;%
function GoToFrame(){%
var frame=app.response({%
% cQuestion:"Which frame?",%
cTitle:"Go To Frame",%
cLabel:"Frame:"%
});%
if(frame==null)return;%
var result=frame.match(/%
^%
\ltx@backslashchar\ltx@backslashchar d+%
$%
/);%
if(result==null){%
app.alert("Invalid number!");%
return;%
}%
var page=FrameList[frame];
if(page==null&&frame>FrameMax)%
page=FrameList[FrameMax];%
if(page==null){%
if(frame<1){%
app.execMenuItem("FirstPage");%
return;%
}%
app.alert("Frame `"+frame+"' not found!");%
return;%
}%
this.gotoNamedDest("Navigation"+page);%
}%
)}%
\immediate\pdfobj{%
<<%
/S/JS%
/JS \the\pdflastobj\space 0 R%
>>%
}%
\immediate\pdfobj{%
<<%
/Names[(\FrPg@Script)\the\pdflastobj\space0 R]%
>>%
}%
\pdfnames{%
/JavaScript \the\pdflastobj\space0 R%
}%
}
\begin{Form}[]
\end{Form}
\def\insertslidenavigationsymbol{%
\begin{pgfpicture}{0pt}{-1.5pt}{20pt}{5.5pt}
\pgfuseobject{beamerslidenavstrong}%
\usebeamercolor[fg]{navigation symbols dimmed}
\pgfuseobject{beamerslidenavlight}%
\end{pgfpicture}\kern-20pt%
\hyperlinkslideprev{\beamer@linkspace{6pt}}%
% \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
\PushButton[
borderwidth=0,
bordercolor=white,
onclick=GoToFrame();
]{\beamer@linkspace{8pt}}%
\hyperlinkslidenext{\beamer@linkspace{6pt}}%
}
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{%
\insertslidenavigationsymbol
}
\defbeamertemplate{footline}{frame number and last}{%
\usebeamercolor[fg]{page number in head/foot}%
\usebeamerfont{page number in head/foot}%
\hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}
\setbeamertemplate{footline}[frame number and last]{}
\begin{document}
\makeatletter
\begin{frame}{This is frame 1}
\onslide<1-2>{Some text\\}
\onslide<2>{\invisible<1>{
Some more text}}
\end{frame}
\begin{frame}{This is frame 2}
This is frame 2
\end{frame}
\begin{frame}{This is frame 3}
This is frame 3
\end{frame}
\end{document}
答案2
您可以在模板中\insertframenavigationsymbol
插入:\insertslidenavigationsymbol
navigation symbols
\documentclass[compress]{beamer}
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{\insertframenavigationsymbol}
{
\defbeamertemplate{footline}{frame number and last}{%
\usebeamercolor[fg]{page number in head/foot}%
\usebeamerfont{page number in head/foot}%
\hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}
\setbeamertemplate{footline}[frame number and last]{}
\begin{document}
\begin{frame}{This is frame 1}
\onslide<1-2>{Some text\\}
\onslide<2>{\invisible<1>{
Some more text}}
\end{frame}
\begin{frame}{This is frame 2}
This is frame 2
\end{frame}
\begin{frame}{This is frame 3}
This is frame 3
\end{frame}
\end{document}
如果要保留由以下程序提供的相同 (Acrobat) 弹出菜单幻灯片导航符号,你可以使用以下代码:
\documentclass[compress]{beamer}
\usepackage{tikz}
\useoutertheme[subsection=false]{miniframes}
\makeatletter
\def\insertmycustomframenavigationsymbol{%
\begin{pgfpicture}{0pt}{-1.5pt}{20pt}{5.5pt}
\pgfuseobject{beamerframenavstrong}%
\usebeamercolor[fg]{navigation symbols dimmed}
\pgfuseobject{beamerframenavlight}%
\end{pgfpicture}\kern-20pt%
%\hyperlinkframestartprev{\beamer@linkspace{6pt}}%
\hyperlinkframeendprev{\beamer@linkspace{6pt}}%
\Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
\hyperlinkframestartnext{\beamer@linkspace{6pt}}%
}
\makeatother
\setbeamertemplate{navigation symbols}{\insertmycustomframenavigationsymbol}
{
\defbeamertemplate{footline}{frame number and last}{%
\usebeamercolor[fg]{page number in head/foot}%
\usebeamerfont{page number in head/foot}%
\hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}
\setbeamertemplate{footline}[frame number and last]{}
\begin{document}
\begin{frame}{This is frame 1}
\onslide<1-2>{Some text\\}
\onslide<2>{\invisible<1>{
Some more text}}
\end{frame}
\begin{frame}{This is frame 2}
This is frame 2
\end{frame}
\begin{frame}{This is frame 3}
This is frame 3
\end{frame}
\foreach \x in {4,...,10}{
\begin{frame}{This is frame \x}
This is frame \x
\end{frame}
}
\end{document}
笔记:正确的反向链接应该是,\hyperlinkframestartprev
但是这个宏没有被定义beamer
......