0

How can I add custom ToC entries that refer to pages after the last page of my document? The company that prints it requests the appendices as separate PDFs, but I'd like the ToC to refer to them anyway. I'm using memoir and lualatex.

I've tried:

  • Manipulating the page counter before calling addcontentsline -- this affects other ToC entries for the current page.
  • Using cftaddtitleline -- this seems to only work for the list of figures and other lists, not the ToC?
  • Adding tens of blank pages and removing them manually using pdfarranger after compilation -- manual work I'd rather avoid.

MWE:

\documentclass{memoir}
\begin{document}
\tableofcontents*
\chapter{foo}
\section{bar}
\addcontentsline{toc}{section}{My external section} % I'd like this to be numbered at 5
\addcontentsline{toc}{section}{My second external section} % I'd like this to be numbered at 39
\end{document}
3
  • Perhaps you should start explaing in better detail what exactly these items are. What is an external section? And how is it related to your PDF? Then it might be easier to suggest a solution.
    – daleif
    Commented Apr 17 at 8:52
  • @daleif Sure, my document is a PhD thesis and the four external sections are academic papers/manuscripts that constitute an appendix. The company that prints the thesis needs them as separate PDFs, but I'd like the ToC in my thesis to refer to them anyway. I don't mind editing these page numbers manually, I'd just like to avoid manual work with every compilation.
    – Anna
    Commented Apr 17 at 8:56
  • That makes good sense, please add this to your question, that might help others in the future.
    – daleif
    Commented Apr 17 at 9:06

1 Answer 1

2
\documentclass{memoir}
\begin{document}
\tableofcontents*
\chapter{foo}
\section{bar}

\addtocontents{toc}{\protect\contentsline{section}{My external section}{5}{}}
\addtocontents{toc}{\protect\contentsline{section}{My external section}{39}{}}
                     
\end{document}

(If you have external toc-files you could also include them in the table of contents).

enter image description here

2
  • Thank you! Just one question, what do you mean by external toc-files?
    – Anna
    Commented Apr 17 at 9:01
  • if your other files are compiled by latex too, they perhaps have a toc file which contains the right page numbers. Then you could use that and avoid to insert the page numbers manually. Commented Apr 17 at 9:05

You must log in to answer this question.

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