1

As it is described in reference manual of etoc, p.34, it is possible to typeset a \localtableofcontents at any place of the document.

One needs only to follow the steps:

  1. \invisiblelocaltableofcontents \label{foo} <-- this inside of section for which you need the toc
  2. \tableofcontents \ref{foo} <-- this at the place WHERE you need the TOC to be typesetted

The question is, how to achieve the same effect for \locallistoftables or \locallistoffigures?

1 Answer 1

0

I am slowly turning into etoc expert here, thanks to going through large parts of its dense document recently in March 2023.

My initial reaction was that this was probably not possible as there is no indication whatsoever that I could find about this in the document of etoc. And I was going to suggest to write the author a feature request, but much to my surprise this seems to work:

\documentclass{article}

\usepackage[lof,lot]{etoc}

\begin{document}

\section{foo}
\etocsetnexttocdepth{none}
\locallistoffigures\label{lof_of_foo}

\subsection{bar}
Some text

\begin{figure}[htbp]
  \centering
  put a graphic here
  \caption{some figure}
  \label{fig:1}
\end{figure}

\section{bar}

\renewcommand\listfigurename{This is LOF of section foo}
\locallistoffigures\ref{lof_of_foo}

\end{document}

as it produces after two compilations from a state with no auxiliary files:

enter image description here

If you add such things to existing document probably 3 passes will be needed I guess.

The \renewcommand\listfigurename{This is LOF of section foo} is only for demonstration purpose. In practice it would force you to reissue it with another definition if further local lofs are done. I see there is a \locallistfigurename but it wouldn't solve the need to have to redefine it at each new one.


A slightly more complex example as stress test:

\documentclass{article}

\usepackage[lof,lot]{etoc}

\renewcommand\localcontentsname{Local table of contents}

\begin{document}

\section{foo}

\localtableofcontents\label{toc_of_foo}

\etocsetnexttocdepth{none}
\locallistoffigures\label{lof_of_foo}

\subsection{subfoo}
Some text

\begin{figure}[htbp]
  \centering
  put a graphic here
  \caption{some figure}
  \label{fig:1}
\end{figure}

\section{bar}

\renewcommand\listfigurename{This is local LOF of section foo}
\locallistoffigures\ref{lof_of_foo}

\renewcommand\localcontentsname{This is local TOC of section foo}
\tableofcontents\ref{toc_of_foo}

\renewcommand\listfigurename{This is local LOF of this section}
\locallistoffigures

\subsection{subbar}
Some text

\begin{figure}[htbp]
  \centering
  put another graphic here
  \caption{some other figure}
  \label{fig:2}
\end{figure}

\end{document}

local list of figures and contents

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .