0

I got some problems while using amsart class and titlesec package.

I customized my section and subsection. Here is my code:

\documentclass{amsart}
\usepackage{titlesec}
\titleformat{\section}[display]{\scshape\center\large}{Lorem \thesection.}{0.5ex}{}
\titleformat{\subsection}{\bfseries}{Ipsum \thesubsection.}{0.5ex}{}
\title{Title}
\author{Author}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\section{Lorem Ipsum}
Lorem Ipsum
\subsection{Dolor Sit Amet}
Dolor Sit Amet
\end{document}

The result is as below: enter image description here

I have three problems. First, the section number is overlapped with section name. Second, I want to make section and subsection in TOC like Lorem 1. Lorem Ipsum and Ipsum 1.1. Dolor Sit Amet, but it shows just 1. Lorem Ipsum and 1.1. Dolor Sit Amet. The third one is that the space between subsection number and its name is too wide.

Is there any easy solution to solve this problem? I need some help.

1

The problem is that amsart uses \@tocline to format the table of contents, which has 7 undocumented arguments (not the same arguments as \@dottedtocline). The easiest solution is to copy the definitions for \l@section and \l@subsection from article class.

One alternative is to copy and modify the definitions of \section and \subsection from amsart. Unfortunately, they call \@startsection which has 6 undocumented arguments. OTOH, one might figure out what they do by trial and error.

\documentclass{amsart}
\usepackage{titlesec}

\makeatletter
\newcommand\@dotsep{4.5}
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil
      \nobreak\hb@xt@\@pnumwidth{\hss #2%
                                 \kern-\p@\kern\p@}\par
    \endgroup
  \fi}
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\makeatother

\titleformat{\section}[display]{\scshape\center\large}{Lorem \thesection.}{0.5ex}{}
\titleformat{\subsection}{\bfseries}{Ipsum \thesubsection.}{0.5ex}{}
\title{Title}
\author{Author}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\section{Lorem Ipsum}
Lorem Ipsum
\subsection{Dolor Sit Amet}
Dolor Sit Amet
\end{document}
  • By the solution the first problem is solved. However \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} does not work. It seems that \@dottedtocline is undefined. Well, your answer is very useful for me. I will find the solution to solve the second problem Thanks a lot! – Caenorhabditis Elegans Jan 23 '19 at 16:54
  • Actually, it was \@dotsep that was undefined. My bad. – John Kormylo Jan 24 '19 at 4:50

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.