1

\addcontentsline{ext}{level}{content} doesn't seem to work correctly for nonstandard ext when multitoc is being used. In particular, the .ext file (.thn in the example below) doesn't seem to be generated at all (or touched, if it already exists).

Commenting out the multitoc import causes the custom list to get populated correctly. Commenting it back in causes the custom list to be blank again, even if the .thn file persists from a previous run.

\addcontentsline{toc}... works correctly in both cases.

\documentclass{article}

\usepackage[toc]{multitoc} % <-- Doesn't seem to matter where this line goes
\usepackage{tocloft}

\newlistof{things}{thn}{List of Things}
\newcommand{\thing}[1]{#1 -- #1\addcontentsline{thn}{things}{#1}}

\begin{document}

\tableofcontents

\listofthings

\section{Things}

\thing{Foo}
\thing{Flang}
\thing{Bar}

\addcontentsline{toc}{section}{Fake section}
\addcontentsline{thn}{things}{Fake Thing}

\end{document}

1 Answer 1

2

multitoc redefines the kernel's \@starttoc and stores the original definition \@multitoc@starttoc, so one option is to restore the original meaning for the new list:

\documentclass{article}
\usepackage[toc]{multitoc}
\usepackage{tocloft}
\newlistof{things}{thn}{List of Things}
\newcommand{\thing}[1]{#1 -- #1\addcontentsline{thn}{things}{#1}}

\begin{document}

\tableofcontents
\makeatletter
\let\@starttoc\@multitoc@starttoc
\listofthings
\makeatother

\section{Things}

\thing{Foo}
\thing{Flang}
\thing{Bar}

\addcontentsline{toc}{section}{Fake section}
\addcontentsline{thn}{things}{Fake Thing}

\end{document}

enter image description here

You must log in to answer this question.

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