5

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}
2
  • Please add a minimal working example illustrating the problem. Jun 2, 2012 at 20:24
  • 1
    The package tocloft is incompatible with amsart. The class amsart is a special class and should only use for papers of AMS. I recommend to use the class scrartlc or memoir with the option article. Jun 2, 2012 at 20:39

1 Answer 1

10

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

3
  • Thank you so much! That's perfect. Can you explain to me what those lines you added mean or direct me somewhere that will explain it?
    – emily
    Jun 3, 2012 at 9:13
  • @emily \l@section, \l@subsection, and \l@subsubsection control how each sectional unit entry will be typeset in the ToC; they use \@tocline which is specific for the AMS-family of document classes (the original definitions can be found in the file amsart.cls) and this command controls the level and spacing for each entry in the ToC; \tocsection, \tocsubsection, \tocsubsubsection are also defined in amsart.cls and give you even more control (you can, for example, easily change the indention) over the entries. Jun 3, 2012 at 13:32
  • @emily All those commands can be found in amsart.cls but, unfortunately, the AMS document classes code is not very well commented. By the way, since my answer seems to have solved your proble, please consider accepting it; in case of doubt, please see How do you accept an answer?. Jun 3, 2012 at 13:33

You must log in to answer this question.

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