我正在尝试获取一个帧列表,其中包含我\frameintoc
在帧环境开始后选择添加的帧。我使用了 [带有 beamer 的帧列表]有没有什么办法可以用投影仪生成帧列表?。我的 MWE 在这里:
\makeatletter%
\let\@starttocorig\@starttoc
\makeatother%%
\documentclass[fleqn,calc,xcolor={usenames}]{beamer}
\usepackage{calc,bookmark}
\definecolor{todo}{rgb}{0.75, 0.0, 0.2}
\makeatletter
\newcommand{\linkdest}[1]{\Hy@raisedlink{\hypertarget{#1}{}}}
\makeatother
%%% COUNTERS
\newcounter{todokey}%
\newcommand\todo[2][todo-\thetodokey]{%todo
\addtocounter{todokey}{1}
\noindent{%
\color{todo}{#2}%
}%
\phantomsection% comment out if hyperref is not used
\linkdest{#1}%
\addcontentsline{todo-\thepart}{subsubsection}{\textbullet\protect\hyperlink{#1}{#2}\hspace{1mm}}%
%\addcontentsline{todo-\thepart}{subsubsection}{todo}
}
\makeatletter
\newcommand{\listoftodosbasic}{%listoftodos
\@starttocorig{todo-\thepart}
}
\newcommand\listtodosname{TODO}%listoftodo
\newcommand\listoftodos{%
\listtodosname\phantomsection:
\listoftodosbasic}
%%frameintoc
\makeatletter
\newcommand\listofframesbasic{\@starttoc{cherryframes}}%%frameintoc cherrry
\makeatother
\newcommand\listofframesname{Important frames}
\newcommand\listofframes{\listofframesname: \listofframesbasic}
\newcommand\frameintoc{%
\def\boolframeintoc{1}
%\phantomsection\linkdest{frametarget-\insertframenumber}%
%\addcontentsline{section}{makebox[2em][l]{hyperlink{frametarget-insertframenumber}{insertframenumber}hfill}hyperlink{frametarget-insertframenumber}{insertframetitle}par}%
}%
\makeatletter
\addtobeamertemplate{frametitle}{}{%
\mode<presentation>{%
\only<1>{%
\hypertarget{\insertframetitle}{}%
%\ifx\beamer@shortframetitle\beamer@frametitle
%\ifx\boolframeintoc1%
%frametitle - prioritate 3
%\addcontentsline{cherryframes}{section}{\protect\makebox[2em][l]{\scriptsize\insertframenumber\hfill}\insertframetitle\par}%
%\fi
}%
}%
\def\boolframeintoc{0}
}
\makeatother
\title{problem setting length block?}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{list of todo}
\listoftodos
\end{frame}
\begin{frame}[fragile]{list of frames}
\listofframes
\end{frame}
\begin{frame}[allowframebreaks,fragile]{one frame}\frameintoc
\begin{block}{block 1}
check
this\todo{ad}, sjdsndns\todo{cawwo}
frame: \todo{889665}
\begin{align}
&a+rt+6+44\label{oh}\\
&r=0
\end{align}
\end{block}
\end{frame}
\begin{frame}[allowframebreaks,fragile]{two frame}\frameintoc
\begin{block}{block 1}
check
this\todo{ad}, sjdsndns\todo{cawwo}
frame: \todo{889665}
\begin{align}
&a+rt+6+44\label{oh}\\
&r=0
\end{align}
\end{block}
\end{frame}
\end{document}
\only<1>
我遇到了:的错误;以及:Argument of \beamer@@@only has an extra }
的错误。我也尝试过不使用,但在 中使用时无法使 addcontentsline 正常工作。有什么建议吗?感谢您的关注和诚挚问候。\addcontentsline
Paragraph ended before \addcontentsline was complete
\addtobeamertemplate
\newcommand
更新
运行答案中的代码有没有什么办法可以用投影仪生成帧列表?导致错误:Paragraph ended before \addcontentsline was complete. error| Extra }, or forgotten \endgroup.
;而相同的代码在 overleaf 上使用 TeXLive 2021 编译时没有错误。我正在运行 pdfTeX 3.141592653-2.6-1.40.22(TeX Live 2022/dev/Debian)。
更新二
问题的一部分似乎与使用有关,allowframebreaks
这导致 toc 文件中第一行和第二行之间的差异output.cherryframes
:
\contentsline {section}{\makebox [1em][l]{\normalsize 4\hfill }\normalsize {one frame\relax {} \let \reserved@d = *\def \par }\par }
\contentsline {section}{\makebox [1em][l]{\normalsize 5\hfill }\normalsize {two frame}\par
其中标题为“一帧”的帧具有参数allowframebreaks
。我将尝试 makerobust 包。还可能存在与\ifx
使用相关的问题。
答案1
似乎有两个问题:
- 使用
allowframebreaks
框架添加到框架列表中 \boolframeintoc
设置为 1 后自动重置为零,\frameintoc
不工作
在下面的代码中,第一个问题使用包解决makerobust
,第二个问题使用的方法有没有什么办法可以用投影仪生成帧列表?(IE \newif
):
\makeatletter%
\let\@starttocorig\@starttoc
\makeatother%%
\documentclass[fleqn,calc,xcolor={usenames}]{beamer}
\usepackage{calc,bookmark,trace}
\definecolor{todo}{rgb}{0.75, 0.0, 0.2}
\usepackage{makerobust}
\MakeRobustCommand\usebeamertemplate
\makeatletter
\newcommand{\linkdest}[1]{\Hy@raisedlink{\hypertarget{#1}{}}}
\makeatother
%%% COUNTERS
\newcounter{todokey}%
\newcommand\todo[2][todo-\thetodokey]{%todo
\addtocounter{todokey}{1}
\noindent{%
\color{todo}{#2}%
}%
\phantomsection% comment out if hyperref is not used
\linkdest{#1}%
\addcontentsline{todo-\thepart}{subsubsection}{\textbullet\protect\hyperlink{#1}{#2}\hspace{1mm}}%
%\addcontentsline{todo-\thepart}{subsubsection}{ todo}
}
\makeatletter
\newcommand{\listoftodosbasic}{%listoftodos
\@starttocorig{todo-\thepart}
}
\makeatother
\newcommand\listtodosname{TODO}%listoftodo
\newcommand\listoftodos{%
\listtodosname\phantomsection:
\listoftodosbasic}
\makeatletter
\newif\ifframeinlbf
\frameinlbftrue
\newcommand\listofframes{\@starttocorig{cherryframes}}
\makeatother
\addtobeamertemplate{frametitle}{%\protect\insertframenumber:
\ifframeinlbf
\mode<presentation>{%
\only<1>{%
\hypertarget{\protect\insertframetitle}{}%
\addcontentsline{cherryframes}{section}{%
\protect\makebox[1em][l]{\normalsize\insertframenumber\hfill}\normalsize\insertframetitle%}%
}%
}%
\else\fi}%
{}%
\title{problem setting length block?}
\begin{document}
\frameinlbffalse
\begin{frame}
\titlepage
\end{frame}
\begin{frame}[fragile]{list of todo}
\listoftodos
\end{frame}
\begin{frame}[allowframebreaks,fragile]{list of frames}
\listofframes
\end{frame}
\frameinlbftrue
\begin{frame}[fragile]{one frame}
\begin{block}{block 1}
check
this\todo{ad}, sjdsndns\todo{cawwo}
frame: \todo{889665}
\begin{align}
&a+rt+6+44\label{oh}\\
&r=0
\end{align}
\end{block}
\end{frame}
\frameinlbftrue
\begin{frame}[fragile,allowframebreaks]{two frame}
\begin{block}{block 1}
check
this\todo{ad}, sjdsndns\todo{cawwo}
frame: \todo{889665}
\begin{align}
&a+rt+6+44\label{oh}\\
&r=0
\end{align}
\end{block}
\end{frame}
\end{document}