6

I am trying to change the depth displayed in the table of contents in my revtex4 document. The usual \setcounter{tocdepth}{1} command has no effect, regardless of what number I put in there, it always displays all the sub and subsubsections in the table of contents. Here is my code.

\documentclass{revtex4}
%\documentclass{article}
\begin{document}
\setcounter{tocdepth}{1}
\tableofcontents
\section{Sec}
blah
\subsection{Subsec}
blah blah
\subsubsection{Subsubsec}
blah blah blah
\end{document}

This output a table of contents with Sec, Subsec, and Subsubsec. When I change the document class to article the problem goes away, and tocdepth works like its supposed to.

Anyone know any quick fixes?

7

revtex4-1 (specifically the aps style) does not rely on tocdepth and prints sections, subsections and subsubsections in the table of contents independently on the counter's value.

The only way to remove sections level is to redefine the relative command producing the entry in the table of contents so they do nothing. One has to keep in mind that the class has been produced to print paper for some journals, which have their styles and authors should not change them.

Of course, you're justified to look for a change if you're using the class for personal purposes. Doing the change in a paper to be submitted will only annoy the copy editors.

\documentclass{revtex4}

% disable subsections and subsubsections in the TOC
\makeatletter
\def\l@subsection#1#2{}
\def\l@subsubsection#1#2{}
\makeatother


\begin{document}
\tableofcontents
\section{Sec}
blah
\subsection{Subsec}
blah blah
\subsubsection{Subsubsec}
blah blah blah
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.