当第一部分变为罗马字母时,章节编号样式会发生变化

当第一部分变为罗马字母时,章节编号样式会发生变化

我正在写一本书,希望将第一部分的编号改为罗马数字,同时保留阿拉伯语第二部分的编号样式。下面我将给出一个最小示例。如果注释掉“\renewcommand”,编号将符合要求。在第一部分使用罗马数字后,所需的嵌套就消失了。我该如何保留原始格式?

    \documentclass[10pt,oneside,usenames,dvipsnames]{book} 
      \setcounter{tocdepth}{2}
    \setcounter{secnumdepth}{2}
    
    \begin{document}
    \tableofcontents
    \renewcommand{\thechapter}{\Roman{chapter}}
    \renewcommand {\thesection}{\Roman{section}}
    \renewcommand {\thesubsection}{\Roman{subsection}}
    
    \part{1}
    \chapter{FIRST}
    \section{First}
    \subsection{first}
    
    
    \renewcommand{\thechapter}{\arabic{chapter}}
    \renewcommand {\thesection}{\arabic{section}}
    \renewcommand {\thesubsection}{\arabic{subsection}}
    \part{2}
    \chapter{SECOND}
    \section{Second}
    Want this numbered as 2.1 which it is until Part I numbering is made Roman. It then appears as just 1. The section numbering style is not as wanted after a Roman Part I.
    \subsection{second}
    Want Numbering here to be 2.1.1 which it is until Part I numbering is made Roman. It appears as 1. The subsection is numbered but the style is wrong. How can I keep the 2.1.1 style of numbering with a Roman Part I?
    
    \subsubsection{2nd}
    
    Want no numbering here, which works with and without the Roman Part 1.
    
    \end{document}

答案1

可以通过在更新的命令前面包含父部分和句号来实现嵌套,如下所示:

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand {\thesection}{\Roman{chapter}.\Roman{section}}
\renewcommand {\thesubsection}{\Roman{section}.\Roman{subsection}}

(当你引入阿拉伯数字时也是同样的)

相关内容