
Quiero redefinir \section
el comando para que pueda recibir una entrada \sectiondesc
; que contendría una descripción al respecto. Considere el MWE:
\documentclass{beamer}
\usepackage{graphicx}
\begin{document}
%%% old definition
\section[short title]{Long Title}
%%% new definition
%\section[short title]{Long Title}{Really long description \\ multiple lines, often with graphics \includegraphics[width=.5\textwidth]{example-image-a}}
\begin{frame}
\sectionpage
\begin{center}
\normalfont
% \sectiondesc
\end{center}
\end{frame}
\end{document}
Respuesta1
La forma con xparse
y \RenewDocumentCommand
es la más fácil, desde mi punto de vista.
Sugiero utilizarlo \section[]{}[]
sin embargo, es decir, es posible omitir la descripción de la sección.
La \sectiondesc
macro se redefine para expandirse a nada con cada \section
llamada, por lo que omitir el cuarto argumento no proporcionará ninguna descripción de la sección.
\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
}%
}
\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
\begin{center}
\normalfont
\sectiondesc
\end{center}
\end{frame}
\section*{Foo}
\begin{frame}
\sectionpage
\begin{center}
\normalfont
\sectiondesc
\end{center}
\end{frame}
\end{document}