0

I've a problem in my table of contents. Some overlap of the numbering of chapter and the corresponding title. Can someone please help me?

Here is my code:

\documentclass{amsart}

\usepackage{xcolor}
\usepackage{titlesec}

\title{My title}


\titleformat{\section}
{\color{red}\normalfont\Large\bfseries}
{\color{red}\thesection}{1em}{}

\titleformat{\subsection}
{\color{red}\normalfont\large\bfseries}
{\color{red}\thesubsection}{1em}{}

\begin{document}    

\maketitle
\tableofcontents



\section{First section}
\subsection{First subsection}
\section{Second section}
\subsection{Second subsection}
\end{document}

and here is the (bad) result:

bad table of contents

3

A disclaimer in the amsart documentation warns you that the document class is not compatible with all available packages. In your case, it appears that it is is incompatible with titlesec (this is because amsart.cls defines its own sectioning commands, table of contents etc.). The authors probably didn't intend you to modify the table of contents style.

Beyond trying to hack the amsart.cls file, which I do not recommend (if you are publishing with AMS you should use their class as is), your options are to use a more conventional document class compatible with titlesec, such as article.

As an aside, I did manage to achieve your intended outcome with the amsart document class by commenting \usepackage{titlesec}, attempting to compile (fail), un-commenting the same line and then compiling (success). This is not a sensible workaround as you will likely encounter other incompatibilities down the line:

output

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.