![如何在 amsbook 中的目录中的章节号之前添加章节号](https://linux22.com/image/444250/%E5%A6%82%E4%BD%95%E5%9C%A8%20amsbook%20%E4%B8%AD%E7%9A%84%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E7%AB%A0%E8%8A%82%E5%8F%B7%E4%B9%8B%E5%89%8D%E6%B7%BB%E5%8A%A0%E7%AB%A0%E8%8A%82%E5%8F%B7.png)
在amsbook
课堂上、在目录中以及在文本中,我想在章节编号前添加带点的章节编号(并且还删除章节编号末尾的点),如下图所示。
\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}
答案1
\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}