Closely Related:
- Mimicking LaTeX's "table of contents" functionality

Using documentclass{minimal}, what is the shortest way to write a low-level asynchronous Table of Contents, (without minitoc, etc.)?

I am hoping to understand the low level API functionality. (I already know how to use the higher level packages, (tocloft, minitoc, etc).

Currently, I have created a "wrapper" around tocloft with an easier to use interface. However, Eventually I would like to remove that dependency.

Note: I am using the term Asynchronous Table of Contents in the sense of a dynamic artifact that is generated as input files are read, (\chapter headings and so on), rather than a static table that is defined and rendered manually.

This question really is related to how to use the write command, or how to use some other asynchronous method to dynamically generate a basic Table of Contents.


\ChapterMacroDefinition  % Is this where the `\write` magic occurs?
\TableOfContentsPlaceHolder % Is there an "End Document" handler?
\Chapter{My First Chapter}
 ... Chapter One Contents
\Chapter{My Second Chapter}
 ... Chapter Two Contents

Notes: This is apart from any formatting or section levels, etc.

  • 2
    Why are you using minimal? It's essentially a test class. Are you interested in the detail of how TOCs work, or is this a more practical question?
    – Joseph Wright
    Mar 15, 2019 at 11:50
  • @JosephWright - It is more of a detail question, rather than practical. I am hoping to understand how the API works. I can't find documentation on it. Mar 15, 2019 at 12:03
  • Asynchronous?? Do you mean, like, writing chapter info to the aux and toc files on the first compiler pass, and then reading the aux and toc files in on the second compiler pass? Mar 15, 2019 at 13:30
  • 2
    What exactly do you mean by async toc? Isn't this what the default \tableofcontents does? Just drop the minimal class
    – daleif
    Mar 15, 2019 at 13:31
  • 2
    Start with basic code: \documentclass{article} \begin{document} \tableofcontents \section{HERE} \end{document} and compile it ONCE. Then, look at the output, and look at the aux file, and look at the toc file. Then compile it AGAIN. See how it works? Mar 15, 2019 at 13:37


You must log in to answer this question.

Browse other questions tagged .