1

I would like to suppress the appendix sections in the table of content in a revtex4 document. I know that revtex4 package overwrites the standard commands related to toc. What shall I do in this case? Thanks!

\documentclass{revtex4}


\begin{document}

% Title page
\title{My Document}
\author{Me}
\maketitle

% Table of contents
\tableofcontents

% Sections and subsections
\section{Introduction}
This is the introduction.

\subsection{Background}
This is the background.

\subsubsection{Details}
This is the subsubsection.

\section{Method}
This is the method.

% Appendix
\appendix
\section{Appendix}
This is the first appendix section.

\section{Another Appendix Section}
This is another appendix section.

\end{document}

enter image description here

a code example is above. and I would like to suppress the "A Appendix" and "B Another Appendix Section" in the table of contents. If possible, I want to replace them with an "Appendix" to represent all appendix sections

2
  • Welcome to TeX.SE! Could you edit your code to begin with your \documentclass{} and end with \end{document} , a Minimal Working Example (MWE) please. It makes copy and pasting easier when the code can be compiled and also we do not need to guess what commands or packages you are using.
    – JamesT
    Commented Apr 16, 2023 at 19:53
  • @JamesT Thanks! edited!
    – XuX
    Commented Apr 16, 2023 at 20:16

1 Answer 1

1

You can use the method of revtex4 to ignore what's in the appendix. But with subsections it will fail.

I use revtex4-2, because revtex4 is obsolete.

\documentclass{revtex4-2}


\begin{document}

% Title page
\title{My Document}
\author{Me}
\maketitle

% Table of contents
\tableofcontents

% Sections and subsections
\section{Introduction}
This is the introduction.

\subsection{Background}
This is the background.

\subsubsection{Details}
This is the subsubsection.

\section{Method}
This is the method.

\subsection{Background}
This is the background.

\subsubsection{Details}
This is the subsubsection.

% Appendix
\appendix
\addtocontents{toc}{\string\tocdepth@munge}
\section{Appendix}
This is the first appendix section.

\section{Another Appendix Section}
This is another appendix section.

\end{document}

enter image description here

Anyway, this works the same with revtex4.

You must log in to answer this question.

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