4

I tried to write table of contents to my book but encountered a problem, as it prints "Sisältö" but there is no table of contents. What is the mistake I made?

\documentclass[11pt,a5paper,twosided,margin=3in]{amsart}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel}
\usepackage{amsmath}
\usepackage[top=0.5in, bottom=0.8in, left=1in, right=1in]{geometry}
\usepackage{fancyhdr} 
\fancyfoot{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\rightmark}
\cfoot{} 
\setlength{\oddsidemargin}{5mm}
\setlength{\evensidemargin}{-5mm}
\linespread{1.5}
\vbadness=20000
\usepackage{titlesec}
\titlespacing{\section}{0pt}{36pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing{\subsection}{0pt}{36pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\pagestyle{fancy} 
\begin{document}
\tableofcontents
\title{title}
\newpage
\section*{Beginning}
Some text.
\subsection*{Start}
\hspace{1em}
Some text.
\end{document}
lockstep
  • 250,273

1 Answers1

6

By default, amsart (unlike the standard classes book, report, article) includes starred headings in the ToC; the problem here is that AMS classes and titlesec are not compatible. Even the simple document

\documentclass{amsart}
\usepackage{titlesec}

\begin{document}

\section{Test section}

\end{document}

produces the error

! Undefined control sequence.
<argument> ...on\endcsname \protect \@secnumpunct 

l.6 \section{Test section}

? 

The lesson is: don't use titlesec with AMS classes. amsart was tai­lored to the de­sign of Amer­i­can Math­e­mat­i­cal So­ci­ety jour­nals. If you want to modify some settings of an AMS class, you need to do it using the "AMS way"; for example, in your case, you will need to change the original definitions of \section and \subsection, and this means that you need to include the following lines in your document:

\makeatletter
\def\section{\@startsection{section}{1}%
  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\scshape\centering}}
\def\subsection{\@startsection{subsection}{2}%
  \z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
  {\normalfont\bfseries}}
\makeatother

and change there the values for the spacing. Another option is just not to use AMS classes at all if you are not submitting to the AMS; switch to the standard class article; in this way, you can use with no problems packages such as titlesec to customize the sectional unit headings, or use memoir or scrartcl (from the KOMA bundle) which offer built-in mechanisms for customization.

Gonzalo Medina
  • 505,128