
Eu tenho esse MWE (acompanhamento deesse)
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{xparse}
\let\beameroldsection\section% Store the old definition first
\def\sectiondesc{}
\RenewDocumentCommand{\section}{sO{#3}m O{}}{%
\gdef\sectiondesc{}
\IfBooleanTF{#1}{% Grab the starred version, i.e. \section*
\beameroldsection*{#3}%
}{%
\beameroldsection[#2]{#3}%
\gdef\sectiondesc{#4}% Store argument 4
}%
}
\setbeamertemplate{section page}
{
\begin{centering}
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}{\insertsection}\par \insertsectionhead
\end{beamercolorbox}
\end{centering}
\begin{center}
\sectiondesc
\end{center}
}
\AtBeginSection[]{
\begin{frame}{Overview}
\hfill
\begin{minipage}{.45\textwidth}
nothing?\sectionpage%\sectiondesc %%% Tried both `\sectionpage` and `\sectiondesc`
\end{minipage}
\end{frame}
}
\begin{document}
\section[short title]{Long Title}[Really long description \\ multiple lines, often with graphics \includegraphics[width=.5\textwidth]{example-image-a}]
\begin{frame}
\sectionpage
\end{frame}
% \section*{Foo}
% \begin{frame}
% \sectionpage
% \end{frame}
\end{document}
O que tentei fazer foi colocar o \sectionpage
no início de cada seção. No entanto, o \sectiondesc
está vazio nesta página.
O que devo fazer para imprimir \sectiondesc
o slide inicial?
Responder1
O \AtBeginSection
código é 'executado', antes que o resto \section
seja chamado, ou seja, o código da seção real ( \beameroldsection
). Na definição da resposta na pergunta vinculada, \sectiondesc
é \gdef
ed para ser {}
, então está sempre vazio no início.
\gdef\sectiondesc{#4}
funciona, se não houver descrição (ou seja, o quarto argumento estiver vazio) a \sectiondesc
macro se expande para nada.
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{xparse}
\let\beameroldsection\section% Store the old definition first
\def\sectiondesc{}
\RenewDocumentCommand{\section}{sO{#3}m O{}}{%
\gdef\sectiondesc{#4}% Store the 4th argument beforehand
\IfBooleanTF{#1}{% Grab the starred version, i.e. \section*
\beameroldsection*{#3}%
}{%
\beameroldsection[#2]{#3}%
}%
}
\setbeamertemplate{section page}
{
\begin{centering}
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}{\insertsection}\par \insertsectionhead
\end{beamercolorbox}
\end{centering}
\begin{center}
\sectiondesc
\end{center}
}
\AtBeginSection[]{
\begin{frame}{Overview}
\hfill
\begin{minipage}{.45\textwidth}
\sectionpage%%% Tried both `\sectionpage` and `\sectiondesc`
\end{minipage}
\end{frame}
}
\begin{document}
\section[short title]{Long Title}[Really long description \\ multiple lines, often with graphics \includegraphics[width=.5\textwidth]{example-image-a}]
\begin{frame}
\sectionpage
\end{frame}
\end{document}