Document ClassesBeamer: Adding lecture title in sidebar

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
mregine
Posts: 3
Joined: Sat Jun 05, 2010 2:42 pm

Beamer: Adding lecture title in sidebar

Post by mregine »

Hi,

I am preparing a lecture with beamer, using the suggestion in the docs to use one file with lectures separated by \lecture{}. I would like the lecture title (instead of the course title) to appear in the sidebar.

In beamerbasesection.sty, I found the following line for parts:

Code: Select all

\addtocontents{nav}{\protect\headcommand{\protect\partentry{#2}{\the\c@part}}}
So I was thinking of trying to modify this, and added it to my \AtBeginLecture{...} declaration.
The {\the\c@part} bit adds the number of the part to the .nav file. I won't be needing this, so I replaced with a place-holder, 0.
But I haven't been able to find something suitable to replace the #2 in there. I do latex, but I don't understand tex much, I must admit. I've tried ...\partentry{\insertlecture}..., but I get an error:

Code: Select all

  ! Missing \endcsname inserted.
   <to be read again> 
                      \@elt 
In beamerbasesection.sty, \insertlecture is defined to be

Code: Select all

\newcommand\insertlecture{\beamer@lecturename}
\beamer@lecturename seems to be defined in beamerbasesection.sty, but I don't understand the definition, so I can't imitate/modify it:

Code: Select all

\def\beamer@lecturename{#2}
What does that #2 refer to?

Can somebody who understand tex better help me with this?
Or suggest a different approach? I'd be very thankful.

(I'm cross-posting to comp.text.tex - not sure which community is more active nowadays)

M-R.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mregine
Posts: 3
Joined: Sat Jun 05, 2010 2:42 pm

Beamer: Adding lecture title in sidebar

Post by mregine »

Hi again,

I've gotten quite a bit further on this, but it still doesn't work. Below is a MWE.

I am now trying to modify the code for \defbeamertemplate in beamerouterthemesidebar.sty, which I've included in the preamble of my document between \makeatletter and \makeatother using \setbeamertemplate{sidebar right} and a corresponding \usebeamertemplate later on.

I don't understand, however, why \vskip works, but not \hskip, and why \insertshortauthor works but not \insertshorttitle, and why neither of these work when width=\beamer@tempdim is given as option, although the dimension is specified. In all cases, when I uncomment these lines, the error is:
! LaTeX Error: Missing \begin{document}.

Then there is the problem of adding \insertlecture. In this case, the error is:
! Undefined control sequence.
\insertlecture ->\beamer@lecturename

It looks like the lecture title is not specified yet, but neither is "shortauthor" at that point, since the author is declared below.

Can anyone help?

(The code as given, with the comments compiles, but when I uncomment things in \setbeamertemplate{sidebar right}{...}, it breaks)

Marie-Régine

Code: Select all

\documentclass{beamer}

\includeonlylecture{lect:somelabel}

\usetheme{Goettingen}

\makeatletter
\newdimen\beamer@sidebarwidth
\beamer@sidebarwidth=2.5\baselineskip
\setbeamertemplate{sidebar right}{
    \beamer@tempdim=\beamer@sidebarwidth%
    \advance\beamer@tempdim by -6pt%
    {
      \usebeamerfont{title in sidebar}%
      \vskip1.5em%
%      \hskip3pt%
      \usebeamercolor[fg]{title in sidebar}%
%      \insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
%      \insertshorttitle[center,respectlinebreaks]\par%
      \vskip1.25em%
    }%
    {%
%      \hskip3pt%
      \usebeamercolor[fg]{author in sidebar}%
      \usebeamerfont{author in sidebar}%
%      \insertshortauthor[width=\beamer@tempdim,center,respectlinebreaks]\par%
      \insertshortauthor[center,respectlinebreaks]\par%
      \vskip1.25em%
    }%
%    \insertlecture
    \insertverticalnavigation{\beamer@sidebarwidth}%
    \vfill
}
\makeatother
\usebeamertemplate{sidebar right}
    
\title{Course Title}

\author{Me}
\date{\today}

\begin{document}

\lecture{Lecture Title}{lect:somelabel}

\section{Section One}
\begin{frame}
Hello World!
\end{frame}

\end{document}
Post Reply