强制章节和小节的编号在未编号的书中按升序排列

强制章节和小节的编号在未编号的书中按升序排列

我正在写一篇论文,需要用到这个book课程。我想把章节中的每个部分都编号为 1.1、1.2 等,但数字看起来很不对。我在特克斯但没有一个人和全班book同学讨论解决方案。

\documentclass{book}
\renewcommand{\thesection}{\arabic{section}}
\begin{document}
\chapter*{Un-numbered chapter}
\subsection{Numbered subsection- should be 1.1}
\subsection{Another numbered subsection - should be 1.2}

\chapter*{Another Un-numbered chapter}
\subsection{Numbered subsection - should be 2.1}
\subsection{subsection - should be 2.2}
\subsubsection{sub-subsection - should be 2.2.1}

\end{document}

答案1

通过不省略\section和设置\setcounter{secnumdepth}{3}数字是正确的,前提是不应该重置。

\documentclass{book}
\renewcommand{\thesection}{\arabic{section}}


\setcounter{secnumdepth}{3}

\begin{document}

\chapter*{Un-numbered chapter}

\section{A numbered section}
\subsection{Numbered subsection- should be 1.1}
\subsection{Another numbered subsection - should be 1.2}


\chapter*{Another Un-numbered chapter}
\section{A numbered section}
\subsection{Numbered subsection - should be 2.1}
\subsection{subsection - should be 2.2}
\subsubsection{sub-subsection - should be 2.2.1}

\end{document}

相关内容