[Tex/LaTex] Table of contents with indents and dots

amsartindentationtable of contents

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?!

Best Answer

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