7

I have a table of contents that looks like the following in my working example.

\documentclass[a4paper,12pt]{amsart}

\usepackage{tikz}
\usepackage{graphicx}
\usepackage{ellipsis}
\usepackage{soul}
\usepackage{amsthm}
\usepackage{amsmath,amssymb}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{caption}
\usepackage{rotating}
\usepackage{pdflscape}
\usepackage{hyperref}
\hypersetup{
    colorlinks,%
    citecolor=black,%
    filecolor=black,%
    linkcolor=black,%
    urlcolor=black
}

\begin{document}

\tableofcontents


\section{Introduction}
\subsection{Subsection}
\subsubsection{Subsubsection}

\section{Section}
\subsection{Subsection}

\end{document}

I would like to indent the subsections in the table of contents, and if possible have dots to the page numbers. Most of other peoples problems seem to be with getting rid of these...any help?!

  • Why do you use the class amsart. It's a special class. In your case I recommend the documentclass scrartcl which can be manipulate really easy. – Marco Daniel Apr 13 '12 at 11:49
  • I have a feeling we were told to use it by our university... I'll have a look into it though. – Izzy Apr 13 '12 at 11:54
  • If they told you to use amsart, why do you want to change the format? – egreg Apr 13 '12 at 12:26
  • Remember also that those dots are not the most aesthetical thing in the world... – mbork Apr 13 '12 at 15:55
12

As I wrote in the commnt I recommend to use another class. The AMS classes are special classes created for AMS. For example the class doesn't work with some other packages like titlesec. So you have to manipulate internal definitions. I think if this class was recommended your university you shouldn't changed the format.

However here an simple approach where I removed non-related packages:

\documentclass[a4paper,12pt]{amsart}
\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
  \ifnum #1>\c@tocdepth % then omit
  \else
    \par \addpenalty\@secpenalty\addvspace{#2}%
    \begingroup \hyphenpenalty\@M
    \@ifempty{#4}{%
      \@tempdima\csname r@tocindent\number#1\endcsname\relax
    }{%
      \@tempdima#4\relax
    }%
    \parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
    \rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
    #5\leavevmode\hskip-\@tempdima
      \ifcase #1
       \or\or \hskip 1em \or \hskip 2em \else \hskip 3em \fi%
      #6\nobreak\relax
    \dotfill\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
    \nobreak
    \endgroup
  \fi}
\makeatother
\usepackage{hyperref}
\begin{document}

\tableofcontents


\section{Introduction}
\subsection{Subsection}
\subsubsection{Subsubsection}

\section{Section}
\subsection{Subsection}

\end{document}

enter image description here

  • This is great, thank you! I have used your solution and it works fantastically! I wanted to change the format because I didn't like the presentation- I assumed we'd been told to use amsart for ease of use or something- I believe the presentation is down to us. – Izzy Apr 13 '12 at 12:52
  • @Izzy: If this question is answered for you, please consider marking them as ‘Accepted’ by clicking on the tickmark below their vote count – Marco Daniel Apr 13 '12 at 20:43
  • Izzy, then why won't you accept the answer? @Marco: amsart is more or less the defacto for mathematicians. Many (dare I say most?) journals ask for papers to be submitted in 'amsart' or 'article' class. Also, 'amsart' with its family of packages (amssymb, amsthm, amstext, amsbsy) provides really nice typesetting for math, including shortcuts for titlepage, like \abstract, \address, \email, etc... – user6551 Mar 28 '13 at 23:48
  • @Marco: I also meant to thank you in the previous comment. Great solution. I'm using it too. – user6551 Mar 28 '13 at 23:48
  • It seems to me that if you have more than 10 sections, then the extra digit will push the section name of the double digit sections further to the right, thus failing to align neatly with others. Of course, this is just a minor issue and everything else worked perfectly. – Jiangwei Xue Mar 21 '14 at 3:49

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.