2

I am using amsart to write my seminar talk. Here is the code for the TOC:

%Table of Contents
\setcounter{tocdepth}{3}
\makeatletter
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
%Make Chapter disapear in ToC
\renewcommand\tocchapter[3]{%
  \indentlabel{\@ifnotempty{#2}{\ignorespaces#2.\quad}}#3%
}
\newcommand\@dotsep{4.5}
\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 plus1em \parfillskip-\@pnumwidth
    #5\leavevmode\hskip-\@tempdima{#6}\nobreak
    \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
    \nobreak
    \hbox to\@pnumwidth{\@tocpagenum{#7}}\par
    \nobreak
    \endgroup
  \fi}
\makeatother
\AtBeginDocument{%
\makeatletter
\expandafter\renewcommand\csname r@tocindent0\endcsname{0pt}
\makeatother
}
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\newcommand\atotoc[1]{\addtocontents{toc}{#1\par}}

It produces

enter image description here

but I want something like this

enter image description here

Basically sections bold an no point after the section number. Is this possible without titletoc or something similar? Thanks in advance.

2
  • The "no dot after section number"... does that pertain to the ToC as well as the document?
    – Werner
    Commented Aug 3, 2016 at 22:46
  • The ''no dot'' should only be in the TOC. In the rest of the document I would like to have a dot after the section number. Commented Aug 3, 2016 at 22:54

1 Answer 1

6

The updates below are for \tocsection, \tocsubsection and one line of code in \@tocline:

enter image description here

\documentclass{amsart}

\makeatletter
%Table of Contents
\setcounter{tocdepth}{3}

% Add bold to \section titles in ToC and remove . after numbers
\renewcommand{\tocsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\bfseries\ignorespaces#1 #2\quad}}\bfseries#3}
% Remove . after numbers in \subsection
\renewcommand{\tocsubsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\ignorespaces#1 #2\quad}}#3}
%\let\tocsubsubsection\tocsubsection% Update for \subsubsection
%...

\newcommand\@dotsep{4.5}
\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 plus1em \parfillskip-\@pnumwidth
    #5\leavevmode\hskip-\@tempdima{#6}\nobreak
    \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
    \nobreak
    \hbox to\@pnumwidth{\@tocpagenum{\ifnum#1=1\bfseries\fi#7}}\par% <-- \bfseries for \section page
    \nobreak
    \endgroup
  \fi}
\AtBeginDocument{%
\expandafter\renewcommand\csname r@tocindent0\endcsname{0pt}
}
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\makeatother

\usepackage{lipsum}

\begin{document}

\tableofcontents

\section{Linear Operators}\lipsum[1-10]

\section{The Real Method}\lipsum[11-20]

\section{The Complex Method}\lipsum[21-30]

\subsection{Hadamard's Three Lines Lemma}\lipsum[31-40]

\section{Interpolation of Analytic Families of Operators}\lipsum[41-50]

\section*{References}\lipsum[1-10]

\end{document}

\tocsection formats the section number and title in the ToC. We've removed the number-trailing . and added \bfseries. Additionally, \bfseries was added to the ToC formatting inside \@tocline only when we're dealing with a \section (the first argument to \@tocline is 1).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .