\lecture{lecture 1}{week 1}

see Lecture \ref{week 1}


This yields

excerpt of slide

yet it would be nice to have something like "see Lecture 'lecture 1'", so printing the title of the lecture with label "week 1".

Any ideas how to implement this? Ideally, this should be compatible with cross-referencing and includeonlylecture as explained at reference to equation from other lecture in class beamer

Icing on the cake would be the following: having a macro \lectureref{label}, where label is a \label{}-label on a frame within the scope of a \lecture{}-lecture.

1 Answer 1


This is actually fairly easily done. You can already manually set a \label for a \lecture and use that for cross-referencing. We can easily insert one at every \lecture using \AtBeginLecture. In order to allow referencing the name, we have to set \@currentlabelname first. (I chose to use the short lecture title for this, but you can the the long form if you prefer.) Then, we can use the usual commands \ref and \nameref.

It is generally advisable to name all your labels with a prefix denoting their type. I chose the lec: prefix here. So you will have to use e.g. the label week-1 in beamer's native commands but lec:week-1 when cross referencing.






\lecture[short week~1 title]{very long and clumsy week~1 title}{week-1}
  a frame

\lecture{week~2 title}{week-2}
  see lecture~\ref{lec:week-1}, which is called~\enquote{\nameref{lec:week-1}}


MWE output

  • 1
    I'll think some more about your icing on the cake, though that is a bit more involved.
    – schtandard
    Jan 27, 2021 at 12:08
  • Great and thanks. Regarding this xr-solution from the other question, I just was surprised that (it seems, if I do not mix things up) I can avoid using this package and the solution with externaldocument when I use frame-labels after the frame I want to reference. Yet a \lectureref-command would be here very handy.
    – Arne
    Jan 27, 2021 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.