# How to add chapter number before section number at TOC in amsbook

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.

• For adding chapter number, before section number, try with \renewcommand{\thesection}{\thechapter.\arabic{section}} Jan 4 at 11:19
• @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

\documentclass{amsbook}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\makeatletter
\def\@seccntformat#1{%
\protect\textup{\protect\@secnumfont
\csname the#1\endcsname\enspace
}%
}
\renewcommand{\tocsection}[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}


• 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. Jan 4 at 13:42