1

The AMS suggests to remove a TOC entry from an amsart document by suppressing the entry just before it is to be added to the TOC.

Their solution works without the biblatex package loaded. However, when I load the biblatex package, it fails, and that TOC entry is still printed even with the skip command. Please see the below MWE demonstrating the problem.

\documentclass{amsart}
% \usepackage{biblatex} %uncomment to see difference
\DeclareRobustCommand{\SkipTocEntry}[4]{}
\begin{document}
\tableofcontents
\addtocontents{toc}{\SkipTocEntry}
\section{First}
\end{document}

Notice that it is not necessary to use biber in the compilation to demonstrate the issue. Using pdflatex on the document alone shows the difference.

  • 1
    If you load biblatex you need to gobble more in the .toc file, since biblatex writes some commands to that file. \DeclareRobustCommand{\SkipTocEntry}[8]{} works. – moewe Jan 05 '20 at 17:45
  • 1
    Very related: https://tex.stackexchange.com/q/513550/35864 and https://tex.stackexchange.com/q/513429/35864 – moewe Jan 05 '20 at 17:45
  • @moewe, that led me to the solution. Gobbling more of the TOC line did exactly what I needed. Would you like to write up the answer so that I can credit you for it? – Jason Hemann Jan 05 '20 at 18:14

1 Answers1

3

As discussed at length in Why does biblatex produce `defcounter` lines in .toc?, biblatex adds additional content to the .toc file. So when you load it you get

\defcounter {refsection}{0}\relax 
\contentsline {section}{\tocsection {}{1}{First}}{1}%

instead of just

\contentsline {section}{\tocsection {}{1}{First}}{1}%

Hence, if you want to gobble the line, you need to gobble more.

\documentclass{amsart}
\usepackage{biblatex} %uncomment to see difference
\DeclareRobustCommand{\SkipTocEntry}[8]{}
\begin{document}
\tableofcontents
\addtocontents{toc}{\SkipTocEntry}
\section{First}
\end{document}

If you load hyperref you need to gobble even more, because the argument structure changes.

\DeclareRobustCommand{\SkipTocEntry}[9]{}
moewe
  • 175,683