![字幕中的 \insertlecture 会产生错误,但 \insertlecturenumber 不会](https://linux22.com/image/320544/%E5%AD%97%E5%B9%95%E4%B8%AD%E7%9A%84%20%5Cinsertlecture%20%E4%BC%9A%E4%BA%A7%E7%94%9F%E9%94%99%E8%AF%AF%EF%BC%8C%E4%BD%86%20%5Cinsertlecturenumber%20%E4%B8%8D%E4%BC%9A.png)
在 中beamer
,如果我使用\insertlecture
字幕,我会得到:
Undefined control sequence \begin{document}
但无论如何,该文件都可以正确编译为 PDF(使用 XeLaTeX)。
但我可以使用\insertlecturenumber
,没有任何错误。
梅威瑟:
\documentclass[xcolor=dvipsnames]{beamer}
\let\Tiny=\tiny
\setbeamercolor{structure}{fg=OliveGreen!50!black}
\usetheme{Madrid}
\title[Title]{Long Title}
\subtitle{Lecture \insertlecturenumber : \insertlecture}
\AtBeginLecture{
\setcounter{framenumber}{0}
\begin{frame}[plain]
\titlepage
\end{frame}
}
\begin{document}
\lecture[LectShort]{LectLong}{1}
\begin{frame}
Text
\end{frame}
\end{document}
如果我改变:
\subtitle{Lecture \insertlecturenumber : \insertlecture}
到:
\subtitle{Lecture \insertlecturenumber}
它工作正常,没有错误。
答案1
我读到过(可能就在不远处),有些命令只有在应用beamer
后才有效。我不知道为什么,也不知道是哪些命令,但我用 OP 的代码测试过,它有效:\begin{document}
\documentclass[xcolor=dvipsnames]{beamer}
\let\Tiny=\tiny
\setbeamercolor{structure}{fg=OliveGreen!50!black}
\usetheme{Madrid}
\AtBeginLecture{
\setcounter{framenumber}{0}
\begin{frame}[plain]
\titlepage
\end{frame}
}
\begin{document}
\title[Title]{Long Title} %<------ Moved to document body
\subtitle{Lecture \insertlecturenumber : \insertlecture} %<--- Moved to document body
\lecture[LectShort]{LectLong}{1}
\begin{frame}
Text
\end{frame}
\end{document}
答案2
由于在使用\lecturename
后可用,您可以在以下位置使用它:\lecture
\AtBeginLecture
\documentclass[xcolor=dvipsnames]{beamer}
\let\Tiny=\tiny
\setbeamercolor{structure}{fg=OliveGreen!50!black}
\usetheme{Madrid}
\title[Title]{Long Title}
\AtBeginLecture{
\setcounter{framenumber}{0}
\subtitle{Lecture~\insertlecturenumber: \insertlecture}
\begin{frame}[plain]
\titlepage
\end{frame}
}
\begin{document}
\lecture[LectShort]{LectLong}{1}
\begin{frame}
Text
\end{frame}
\end{document}