0

In amsbook class, at the TOC, and also in the text, I want to add the chapter number, with a dot, before the sections numbers (and also to remove the dot at the end of the sections numbers), as in the pictures below.

\documentclass[12pt]{amsbook}
\usepackage{amsfonts,amsmath}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}

\begin{document}
\tableofcontents

\chapter{Title of the first chapter}

\section{Title of the first section}
wsdqwewqgtewhtrdjnyedty

\section{Title of the second section}
wsdqwewqgtewhtrdjnyedty

\chapter{Title of the second chapter}

\section{Title of the first section}
wsdqwewqgtewhtrdjnyedty

\section{Title of the second section}
wsdqwewqgtewhtrdjnyedty

\end{document}

How can I do this? Any help will be appreciated. enter image description here enter image description here

4
  • For adding chapter number, before section number, try with \renewcommand{\thesection}{\thechapter.\arabic{section}}
    – MadyYuvi
    Jan 4 at 11:19
  • 1
    @MadyYuvi Thank you! It works well.
    – Cris
    Jan 4 at 12:21
  • I think the topic can be closed.
    – Cris
    Jan 4 at 12:22
  • @Cris And the dots after the numbers? Jan 4 at 12:56

1 Answer 1

2
\documentclass{amsbook}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\makeatletter
\def\@seccntformat#1{%
  \protect\textup{\protect\@secnumfont
    \csname the#1\endcsname\enspace
  }%
}
\renewcommand{\tocsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\ignorespaces#1 #2\quad}}#3}
\makeatother
\begin{document}

\tableofcontents

\chapter{Title of the first chapter}

\section{Title of the first section}
wsdqwewqgtewhtrdjnyedty

\section{Title of the second section}
wsdqwewqgtewhtrdjnyedty

\chapter{Title of the second chapter}

\section{Title of the first section}
wsdqwewqgtewhtrdjnyedty

\section{Title of the second section}
wsdqwewqgtewhtrdjnyedty
\end{document}

enter image description here

2
  • Thank you for your answer! I was doing the same, by removing the dot after the second "#2", directly in the .cls file.
    – Cris
    Jan 4 at 13:41
  • You may consider adding an image of the output. An output image helps others to find expected results easily.
    – Imran
    Jan 4 at 13:42

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.