
Intentando programar una macro similar a \adcontentsline
: Aplicar \immediate\write
a, digamos,
\frameEntry{\insertframenumber}{\inserframetitle \}{\thepage}
registra el número de página incorrecto. Por el contrario, si \write
se pospone hasta el momento en que se envía la página, se registra lo incorrecto \insertpagenumber
y lo incorrecto .\insertpagetitle
Más contexto: trabajo en escribir mi propio pequeño conjunto de macros para tabla de contenidos, con el propósito de generar una edición de un conjunto de algunos cientos de diapositivas en article
modo. El desafío es producir una lista de cuadros al estilo de una tabla de contenido, justo después de cada uno \subsection
.
Paquetes como minitoc
y titletoc
no funcionaron. El primero porque se niega a producir un índice y el segundo porque no encaja bien con el hyperref
.
Respuesta1
Paqueteetoces incompatible con la beamer
clase.
Sin embargo, si beamer
se usa en un article
modo, es decir, con la article
clase y el beamerarticle
paquete, entonces etoc
es aplicable:
\documentclass{article}
\usepackage{beamerarticle}
\usepackage{etoc}
% section=1, subsection=2, subsubsection=3
\etocsetlevel {beamerframe}{6}% dummy, a priori invisible, level
\etocsettocdepth {all}
% Earlier provisory code by jfbu
% \let\oldframetitle \frametitle
% \renewcommand\frametitle [1]{%
% \etoctoccontentsline{beamerframe}{#1}%
% \oldframetitle {#1}%
% }
%%%%
% Better code by Yossi Gil
% Override action when frame title is encountered:
\setbeamertemplate{frametitle}{%
\paragraph{\insertframenumber.~\insertframetitle}\\
\noindent\emph{\insertframesubtitle}\par
\etoctoccontentsline{beamerframe}{\insertframenumber.~\insertframetitle}%
}
%%%%
% Command to list frames in a sub-section:
\newcommand\listofframesinsubsection {\begingroup
% we are going to list one frame per line, with dots up to the page number,
% this is the default etoc design for subsections, we thus need to set the
% level of a beamerframe to 2. But then we need to artificially move up the
% leve of subsection so that \localtableofcontents does see the beamerframes
% as sub levels of a subsection
\etocsetlevel {subsection}{1}% artificially pretending subsections are
% sections one up the level
\etocsetlevel {beamerframe}{2}% pretending beamerframes are subsections
\etoctoclines % use the styles defined by \etocsetstyle, or here, as we
% didn't make any use of \etocsetstyle, just defaults
% to the package default styles (which are convenient for
% us here.)
\etocsettocstyle {\noindent Frames in this subsection:\par}{}%
\etocsetnexttocdepth {beamerframe}%
\localtableofcontents
\endgroup % clean up all our mess for the next \localtableofcontents not to
% be affected and proceed in compatibility mode with the same
% default design as in article class
}
\begin{document}
\etocsetnexttocdepth {subsection}
\tableofcontents
\section{Some frames}
%\etocsettocstyle{\subsection*{Local contents:}}{}
\etocsettocstyle {}{}
\etocsetnexttocdepth {subsection}
\localtableofcontents
\subsection {first subsection}
\listofframesinsubsection
\begin{frame}\frametitle{AHK}
Ah Ah
\end{frame}
\begin{frame}\frametitle{AHJ}
Oh Oh
\end{frame}
\subsection {second subsection}
\listofframesinsubsection
\begin{frame}\frametitle{HBZ}
Ah Ah
\end{frame}
\begin{frame}\frametitle{HBW}
Oh Oh
\end{frame}
\section{More frames}
%\etocsettocstyle{\subsection*{Local contents:}}{}
\etocsettocstyle {}{}
\etocsetnexttocdepth {subsection}
\localtableofcontents
\subsection {third subsection}
\listofframesinsubsection
\begin{frame}\frametitle{BHK}
Ah Ah
\end{frame}
\begin{frame}\frametitle{BHJ}
Oh Oh
\end{frame}
\subsection {fourth subsection}
\listofframesinsubsection
\begin{frame}\frametitle{BBZ}
Ah Ah
\end{frame}
\begin{frame}\frametitle{BBW}
Oh Oh
\end{frame}
\end{document}
(las imágenes se han regenerado para reflejar la inserción del número de fotograma agregado en el código actualizado)
Nota: en el código anterior, los marcos declaran un párrafo; Si los únicos párrafos que se encuentran en las subsecciones están asociados de tal manera con marcos, es posible simplificar el preámbulo, no es necesario definir un beamerframe
nivel de sección para etoc
. Aquí hay un preámbulo simplificado (si el documento ya ha sido compilado con el preámbulo anterior, se deben descartar los archivos auxiliares o simplemente compilar dos veces, ignorando el error en la primera compilación).
\documentclass{article}
\usepackage{beamerarticle}
\usepackage{etoc}
% section=1, subsection=2, subsubsection=3
\etocsettocdepth {all}
\setbeamertemplate{frametitle}{%
\paragraph{\insertframenumber.~\insertframetitle}\\
\noindent\emph{\insertframesubtitle}\par
}
% Command to list frames in a sub-section:
\newcommand\listofframesinsubsection {\begingroup
\etocsetlevel {subsection}{1}% pretending subsections are sections
\etocsetlevel {paragraph}{2}% pretending paragraphs are subsections
\etoctoclines % allows to use the package default styles for subsections
\etocsettocstyle {\noindent Frames in this subsection:\par}{}%
\etocsetnexttocdepth {paragraph}%
\localtableofcontents
\endgroup
}
[YG:]
Los comandos anteriores no funcionarán en ningún otro modo que no sea article
. Por esta razón, probablemente sea mejor proteger lo anterior en \mode{
la mayor parte del preámbulo anterior }
.
Otra buena práctica es utilizar dos archivos separados, para el modo artículo y diapositivas. Ambos archivos deben ser \input
los archivos donde están los marcos reales. Si esto es lo que hace, entonces no hay necesidad de dicha protección.