1

I'm using the etoc package with the memoir document class to get two tables of contents (TOCs): a Short Contents listing only chapters and sections, and a Detailed Contents also including subsections.

Aim: I want neither TOC to be self-referential, but each to refer to the other. That is, I want the Short Contents to include an entry for the Detailed Contents but not for itself; and the Detailed Contents to include an entry for the Short Contents but not for itself.

Constraint: The memoir pagestyle and chapterstyle in effect need to be preserved.

(Compare memoir: headers for short and detailed tables of contents.)

The method shown in https://tex.stackexchange.com/a/346433/13492, unfortunately, does not preserve the pagestyle for pages after chapter page in the Short Contents and the Long Contents. It does, however, produce the wanted entries of each of the two TOCs in, and only in, the other; and it makes the links on each of those entries point to the top of the corresponding TOC page.

Attempt: The following MWE almost accomplishes this:

  • the Detailed Contents does have an entry for Short Contents but not for itself; however,
  • the Short Contents does just the opposite of what I want -- it has an entry for itself but not for the Detailed Contents.

Note that the Detailed Contents is produced with \tableofcontents*, the starred version whereas the Short Contents is produced with \tableofcontents, the unstarred version.

Caution: If I use the starred version for both tables, then neither table has entries for either itself or the other one.

Question: How can I accomplish my aim?

\documentclass{memoir}

\pagestyle{plain}
\chapterstyle{default}

\setsecnumdepth{subsection}

\usepackage{hyperref}

% TOC STUFF
\usepackage{etoc}

\AtBeginDocument{\addtocontents{toc}{\protect\hypersetup{hidelinks}}}

\begin{document}

\frontmatter

\etocsettocdepth{1}
\renewcommand{\contentsname}{Short Contents}
\tableofcontents  % <--- unstarred
\clearpage

\etocsettocdepth{2}
\renewcommand{\contentsname}{Detailed Contents}
\tableofcontents* % <--- starred
\clearpage

\mainmatter

\newcommand\Sample{
  \chapter{Chap}This is a chapter.
  \section{Sec}This is a section.
  \subsection{Subsec}This is a subsection.
}
\Sample\Sample

\end{document}

Detailed Contents OK

Short Contents WRONG

A partial solution not using etoc

See https://tex.stackexchange.com/a/512752/13492.

However, this method not using etoc* **does not work if biblatex is also loaded. See: memoir + biblatex + 2 TOCs error .

murray
  • 7,944
  • I apologise but I haven't come up with a solution to your problem. – Peter Wilson Oct 20 '19 at 19:15
  • What exactly is wrong with the answer I provided to the other question? Now, I even figured out how to get the cross ref to jump above the toc header. – daleif Oct 22 '19 at 15:27
  • @daleif: Just saw your amended answer to https://tex.stackexchange.com/questions/512742/memoir-headers-for-short-and-detailed-tables-of-contents, and that does everything I requested. Thank you1 – murray Oct 22 '19 at 17:10
  • @PeterWilson it is doable with memoir alone, see the added link to the OPs question – daleif Oct 23 '19 at 11:13
  • @PeterWilson: but the added link in the OP's question gives a method that fails if biblatex is also loaded! See: https://tex.stackexchange.com/questions/513429/memoir-biblatex-2-tocs-error – murray Oct 23 '19 at 22:32
  • @murray I have already said that I haven't come up to a solution to your problem. Why are you complaining to me me about someone else solution? GOM – Peter Wilson Oct 25 '19 at 17:39
  • @PeterWilson: Sorry, I seem to have interchanged references. It looks like https://tex.stackexchange.com/a/512752/13492 completely solves the problem for me; I'm just checking it now against my actual (non-MWE) book source. – murray Oct 26 '19 at 14:53

0 Answers0