I am having difficulty combining all the attributes for this kind of Table of Contents in my amsart document. I hope if someone can show me the complete template, it will be useful for many people. Every time I search and find one of the attributes, it does not work with the rest of the attributes. Hope someone can help.

The whole row for sections should be bold, including the section number and section page number.

Specifications:

1. No line of dots before section page numbers.

2. Line of dots before subsections and subsubsection numbers.

3. Indented subsections aligned with section name, as below.

4. Adjustable \vspace between a subsection and the major section that follows. If it is a subsubsection followed by the major section, there should be adjustable \vspace for that.

5. No \vspace between subsections in a given section. No \vspace between subsubsections

6. Adjustable \hspace between section number and title of section.

7. Adjustable \hspace between subsection number and title of subsection, etc.

8. Adjustable font size and font for "Contents".

9. Bold section names and pages, regular text for subsections.

10. (Optional) Choose where the ToC page breaks when continuing to next page.

11. (Optional) Move the ToC up from its default lower position.

Contents (Larger adjustable size and font)

1  No dot after section number, bold name, then white space, bold page number

1.1  Subsection not bold . . . . . . . . . . . . . . . . . . . .  1

1.2  Subsection  . . . . . . . . . . . . . . . . . . . . . . . .  3

1.2.1  Subsubsection  . . . . . . . . . . . . . . . . . . .  7

1.2.2  Subsubsection  . . . . . . . . . . . . . . . . . . .  9

2  No dot after number, bold name, then white space, bold page number

2.1  Subsection not bold . . . . . . . . . . . . . . . . . . . . 11

2.2  Subsection  . . . . . . . . . . . . . . . . . . . . . . . . 13

2.2.1  Subsubsection   . . . . . . . . . . . . . . . .  . . 17

2.2.2  Subsubsection    . . . . . . . . . . . . . . . . . . 19

Appendix A  --also bold with bold page number to the right -->

A.1  First Section of Appendix A . . . . . . . . . . . . . . . . 21

A.2  Second Section of Appendix A  . . . . . . . . . . . . . . . 23

A.2.1  Subsection of second section of Appendix A . . . . . 27

A.2.2  another Subsection   . . . . . . . . . . . . . . . . 29

Appendix B  --also bold with bold page number to the right -->

B.1  First Section of Appendix B . . . . . . . . . . . . . . . . 31

B.2  Second Section of Appendix B  . . . . . . . . . . . . . . . 33

References  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42


The following is a minimal tex shell, added at the request of the commenter

    \documentclass[onecolumn,10.5pt,reqno,a4paper]{amsart}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage[margin=1.55in]{geometry}
\usepackage{geometry}
\usepackage{graphicx}

\begin{document}

\pagenumbering{roman}

\maketitle
\tableofcontents
\clearpage
\pagenumbering{arabic}
\setcounter{page}{1}

\section{section 1, No point after section #, followed by name, whitespace, bold page} Text
\subsection{subsection 1.1 (not subsection 1.1.), followed by dots, regular page #} Text
\subsection{subsection 1.2 (not subsection 1.2.), followed by dots, regular page #} Text
\subsubsection{subsubsection} Text

\section{section 2, No point after section #, followed by name, whitespace, bold page} Text
\subsection{subsection 2.1 (not subsection 1.1.), followed by dots, regular page #} Text
\subsubsection{subsubsection} Text
\subsection{subsection 2.2 (not subsection 1.2.), followed by dots, regular page #} Text

\section{section 3} Text

\appendix
\section{first section of appendix} Text
\subsection{subsection} Text
\subsubsection{subsubsection} Text
\subsection{subsection} Text

\section{second section of appendix} Text

\thebibliography{99}

\end{document}

• For future reference, please post something the community can work with, even if it's just a shell of a document that contains the structure you're looking for. Ideally it should be a minimal working example (MWE). – Werner Apr 27 '14 at 20:34
• a shell document is posted now – user50654 Apr 27 '14 at 21:07
• not relevant to the answer, but suggestions re using amsart: there is no 10.5pt option; the features of amsthm are built in, and amsmath is loaded automatically, so it's not necessary to include them with \usepackage; geometry is loaded twice (and loading geometry will affect the page formatting even if no options are requested). – barbara beeton Apr 28 '14 at 0:06

The amsart document class has a very strict way in which it sets things up, specifically because it is meant for publication submissions. As such, there's not much in terms of user-interface variation available. This is a good thing. However, it requires a complete revamp of the ToC-generation and interaction in order for it to be flexible.

Here is something that seems to satisfy all your requirements without using any additional packages (except etoolbox):

\documentclass{amsart}
\usepackage[showframe,paper=a5paper]{geometry}% Just for this example
\usepackage{etoolbox}

% Modifications to amsart ToC-related macros...
\makeatletter
\let\old@tocline\@tocline
\let\section@tocline\@tocline
% Insert a dotted ToC-line for \subsection and \subsubsection only
\newcommand{\subsection@dotsep}{4.5}
\newcommand{\subsubsection@dotsep}{4.5}
\patchcmd{\@tocline}
{\hfil}
{\nobreak
\leaders\hbox{$\m@th \mkern \subsection@dotsep mu\hbox{.}\mkern \subsection@dotsep mu$}\hfill
\nobreak}{}{}
\let\subsection@tocline\@tocline
\let\@tocline\old@tocline

\patchcmd{\@tocline}
{\hfil}
{\nobreak
\leaders\hbox{$\m@th \mkern \subsubsection@dotsep mu\hbox{.}\mkern \subsubsection@dotsep mu$}\hfill
\nobreak}{}{}
\let\subsubsection@tocline\@tocline
\let\@tocline\old@tocline

\let\old@l@subsection\l@subsection
\let\old@l@subsubsection\l@subsubsection

\def\@tocwriteb#1#2#3{%
\begingroup
\@xp\def\csname #2@tocline\endcsname##1##2##3##4##5##6{%
\ifnum##1>\c@tocdepth
\else \sbox\z@{##5\let\indentlabel\@tochangmeasure##6}\fi}%
\csname l@#2\endcsname{#1{\csname#2name\endcsname}{\@secnumber}{}}%
\endgroup
{\protect#1{\csname#2name\endcsname}{\@secnumber}{#3}}}%

% Handle section-specific indentation and number width of ToC-related entries
\newlength{\@tocsectionindent}
\newlength{\@tocsubsectionindent}
\newlength{\@tocsubsubsectionindent}
\newlength{\@tocsectionnumwidth}
\newlength{\@tocsubsectionnumwidth}
\newlength{\@tocsubsubsectionnumwidth}
\newcommand{\settocsectionnumwidth}[1]{\setlength{\@tocsectionnumwidth}{#1}}
\newcommand{\settocsubsectionnumwidth}[1]{\setlength{\@tocsubsectionnumwidth}{#1}}
\newcommand{\settocsubsubsectionnumwidth}[1]{\setlength{\@tocsubsubsectionnumwidth}{#1}}
\newcommand{\settocsectionindent}[1]{\setlength{\@tocsectionindent}{#1}}
\newcommand{\settocsubsectionindent}[1]{\setlength{\@tocsubsectionindent}{#1}}
\newcommand{\settocsubsubsectionindent}[1]{\setlength{\@tocsubsubsectionindent}{#1}}

% Handle section-specific formatting and vertical skip of ToC-related entries
% \@tocline{<level>}{<vspace>}{<indent>}{<numberwidth>}{<extra>}{<text>}{<pagenum>}
\renewcommand{\l@section}{\section@tocline{1}{\@tocsectionvskip}{\@tocsectionindent}{}{\@tocsectionformat}}%
\renewcommand{\l@subsection}{\subsection@tocline{1}{\@tocsubsectionvskip}{\@tocsubsectionindent}{}{\@tocsubsectionformat}}%
\renewcommand{\l@subsubsection}{\subsubsection@tocline{1}{\@tocsubsubsectionvskip}{\@tocsubsubsectionindent}{}{\@tocsubsubsectionformat}}%
\newcommand{\@tocsectionformat}{}
\newcommand{\@tocsubsectionformat}{}
\newcommand{\@tocsubsubsectionformat}{}
\expandafter\def\csname toc@1format\endcsname{\@tocsectionformat}
\expandafter\def\csname toc@2format\endcsname{\@tocsubsectionformat}
\expandafter\def\csname toc@3format\endcsname{\@tocsubsubsectionformat}
\newlength{\@tocsectionvskip}
\newcommand{\settocsectionvskip}[1]{\setlength{\@tocsectionvskip}{#1}}
\newlength{\@tocsubsectionvskip}
\newcommand{\settocsubsectionvskip}[1]{\setlength{\@tocsubsectionvskip}{#1}}
\newlength{\@tocsubsubsectionvskip}
\newcommand{\settocsubsubsectionvskip}[1]{\setlength{\@tocsubsubsectionvskip}{#1}}

% Adjust section-specific ToC-related macros to have a fixed-width numbering framework
\patchcmd{\tocsection}{\indentlabel}{\makebox[\@tocsectionnumwidth][l]}{}{}
\patchcmd{\tocsubsection}{\indentlabel}{\makebox[\@tocsubsectionnumwidth][l]}{}{}
\patchcmd{\tocsubsubsection}{\indentlabel}{\makebox[\@tocsubsubsectionnumwidth][l]}{}{}

% Allow for section-specific page numbering format of ToC-related entries
\newcommand{\@sectypepnumformat}{}
\renewcommand{\contentsline}[1]{%
\expandafter\let\expandafter\@sectypepnumformat\csname @toc#1pnumformat\endcsname%
\csname l@#1\endcsname}
\newcommand{\@tocsectionpnumformat}{}
\newcommand{\@tocsubsectionpnumformat}{}
\newcommand{\@tocsubsubsectionpnumformat}{}
\renewcommand{\@tocpagenum}[1]{%
\hfill {\mdseries\@sectypepnumformat #1}}

% Small correction to Appendix, since it's still a \section which should be handled differently
\let\oldappendix\appendix
\renewcommand{\appendix}{%
\leavevmode\oldappendix%
\protect\settowidth{\protect\@tocsectionnumwidth}{\protect\@tocsectionformat\sectionname\space}%
}
\makeatother

% #1 (default is as required)

% #2

% #3
\makeatletter
\settocsectionnumwidth{2em}
\settocsubsectionnumwidth{2.5em}
\settocsubsubsectionnumwidth{3em}
\settocsectionindent{1pc}%
\settocsubsectionindent{\dimexpr\@tocsectionindent+\@tocsectionnumwidth}%
\settocsubsubsectionindent{\dimexpr\@tocsubsectionindent+\@tocsubsectionnumwidth}%
\makeatother

% #4 & #5
\settocsectionvskip{10pt}
\settocsubsectionvskip{0pt}
\settocsubsubsectionvskip{0pt}

% #6 & #7
% See #3

% #8
\renewcommand{\contentsnamefont}{\bfseries\Large}

% #9
\settocsectionformat{\bfseries}
\settocsubsectionformat{\mdseries}
\settocsubsubsectionformat{\mdseries}
\setsectionpnumformat{\bfseries}
\setsubsectionpnumformat{\mdseries}
\setsubsubsectionpnumformat{\mdseries}

% #10
% Insert the following command inside your text where you want the ToC to have a page break

% #11
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{%
\vspace*{-\linespacing}% Default gap to top of CONTENTS is \linespacing.
\oldtableofcontents}

\setcounter{tocdepth}{3}
\begin{document}

\tableofcontents
\section{First section}
\subsection{First subsection}
\subsection{Second subsection}
\subsubsection{First subsubsection}
\subsubsection{Second subsubsection}
\section{Second section}
\subsection{First subsection}
\tocpagebreak
\subsection{Second subsection}
\subsubsection{First subsubsection}
\subsubsection{Second subsubsection}

\appendix
\section{An appendix section}
\subsection{First appendix subsection}
\subsection{Second appendix subsection}
\subsubsection{First appendix subsubsection}
\subsubsection{Second appendix subsubsection}
\end{document}


Specific to the requirements:

1. This is the default setting under amsart, so there's nothing to be done in this regard.

2. Only the \subsection and \subsubsection ToC entries have been adjusted to include a dotted line. This was taken from latex.ltx's \@dottedtocline that uses leaders.

Adjustments to the spacing between the dots can be achieved using (for example)

\makeatletter
\makeatother


The default values for both are 4.5.

3. The indentation can be set for each of the section levels \section, \subsection and \subsubsection, in addition to the width of the numbers in the ToC. The following self-explanatory macros set the defaults:

\makeatletter
\settocsectionnumwidth{2em}
\settocsubsectionnumwidth{2.5em}
\settocsubsubsectionnumwidth{3em}
\settocsectionindent{1pc}%
\settocsubsectionindent{\dimexpr\@tocsectionindent+\@tocsectionnumwidth}%
\settocsubsubsectionindent{\dimexpr\@tocsubsectionindent+\@tocsubsectionnumwidth}%
\makeatother


The subsection and subsubsection indents are set relative to the sections and subsections, making them line up within the ToC as required.

4. The default \@tocline macro of amsart provides a vertical skip before every sectional unit. This has been customized and can be set with a number of user-interface macros. The defaults are:

\settocsectionvskip{10pt}
\settocsubsectionvskip{0pt}
\settocsubsubsectionvskip{0pt}


This leaves a gap of at least 10pt above a \section heading, but no gap (0pt) above a subsection or subsubsection.

5. See (4) above.

6. This can be adjusted using the number widths as refined in (3) above.

7. See (6).

8. \contentsnamefont holds the formatting of the ToC heading. A simple \renewcommand suffices to changes this. For example,

\renewcommand{\contentsnamefont}{\bfseries\Large}

9. Each sectional heading in the ToC can be formatted at the "number+title" and "page number" level via the following self-explanatory macros:

\settocsectionformat{\bfseries}
\settocsubsectionformat{\mdseries}
\settocsubsubsectionformat{\mdseries}
\setsectionpnumformat{\bfseries}
\setsubsectionpnumformat{\mdseries}
\setsubsubsectionpnumformat{\mdseries}

10. (Optional) Insert \tocpagebreak within your document at the appropriate place between sectional units where you want the equivalent location to be broken in the ToC.

11. (Optional) \tableofcontents can be adjusted to insert a negative \vspace where appropriate.

This adaptation is not compatible with hyperref, unfortunately. If that is required, one may be better off by recreating the ToC and sectional unit layout using packages that support this in a more consistent/uniform way, and using a different class like article.