2

In beamer, if I use \insertlecture in a subtitle I get:

Undefined control sequence \begin{document}

but the file compiles to PDF (with XeLaTeX) correctly anyway.

But I can use \insertlecturenumber with no error.

MWE:

\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}

If I change:

\subtitle{Lecture \insertlecturenumber : \insertlecture}

To:

\subtitle{Lecture \insertlecturenumber}

It works with no error.

0

2 Answers 2

2

I've read somewhere (probably not far away) that some beamer commands are not valid until \begin{document} has been applied. I don't know why and don't know which commands, but I've tested with OP's code and it worked:

\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}

enter image description here

1
  • Thanks that helps fix the problem, will test it on the dynamic bottom bar now. Commented Oct 8, 2015 at 20:24
2

Since \lecturename is available after \lecture has been used, you can use it in your \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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .