[Tex/LaTex] Adding indents to the ToC without adding dotted lines between sections

amsarttable of contentstocloft

I wanted to add indents to format my ToC so I added the tocloft package I saw recommended on other threads. Now the indentation is perfect, but there is a dotted line in between each section in the actual body of the article. For example, it shows:

1.1 Method.

1.1 ………………………………..

Before it would have only shown that first line, not the second line with the second set of numbers and the dotted line. How do I get rid of that?

\documentclass[11pt]{amsart}
\usepackage{tocloft}

\begin{document}

\setcounter{tocdepth}{4}
\tableofcontents
\newpage

\section{Experiment 1}
\subsection{Method}
\subsubsection{Participants}
\subsubsection{Stimuli}
\subsubsection{Procedure}
\subsection{Results}

\end{document}

Best Answer

amsart and tocloft are not compatible. You can either use another document class or, if you want to continue using amsart, you'll need to redefine \l@section, \l@subsection, and \l@subsubsection, \tocsection, \tocsubsection, and \tocsubsubsection; something along these lines:

\documentclass[11pt]{amsart}

\makeatletter
\def\l@section{\@tocline{1}{0pt}{1pc}{}{}}
\def\l@subsection{\@tocline{2}{0pt}{1pc}{4.6em}{}}
\def\l@subsubsection{\@tocline{3}{0pt}{1pc}{7.6em}{}}
\renewcommand{\tocsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\makebox[2.3em][l]{%
    \ignorespaces#1 #2.\hfill}}}#3}
\renewcommand{\tocsubsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\hspace*{2.3em}\makebox[2.3em][l]{%
    \ignorespaces#1 #2.\hfill}}}#3}
\renewcommand{\tocsubsubsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\hspace*{4.6em}\makebox[3em][l]{%
    \ignorespaces#1 #2.\hfill}}}#3}
\makeatother

\setcounter{tocdepth}{4}

\begin{document}

\tableofcontents

\newpage

\section{Experiment 1}
\subsection{Method}
\subsubsection{Participants}
\subsubsection{Stimuli}
\subsubsection{Procedure}
\subsection{Results}

\end{document}

enter image description here

Related Question