将 scheme=chinese 时的“第1章”改为“第一章”

This commit is contained in:
syvshc
2022-05-28 03:16:38 +08:00
parent 48f19691fc
commit b1585deeb9
2 changed files with 18 additions and 9 deletions

View File

@@ -844,8 +844,12 @@
\ifdefstring{\ELEGANT@lang}{cn}{
\ifdefstring{\ELEGANT@scheme}{chinese}{
\newcommand{\xchaptertitle}{\zhnumber{\arabic{chapter}}} }{
\newcommand{\xchaptertitle}{ \thechapter{} }} }{
\newcommand{\xchaptertitle}{\chaptername~\thechapter~}}
\newcommand{\xchaptertitle}{ \thechapter{} }}
\patchcmd{\NR@chapter}%
{\numberline{\thechapter}}{\numberline{\xchaptertitle}}%
{}{\fail}
}
{\newcommand{\xchaptertitle}{\chaptername~\thechapter~}}
\setcounter{secnumdepth}{5}
\titleformat{\chapter}[\style]{\bfseries}{
@@ -1369,13 +1373,17 @@ beforechap\newpage%
% https://tex.stackexchange.com/questions/56839/chaptername-is-used-even-for-appendix-chapters-in-toc
\usepackage{calc}
\usepackage[titles]{tocloft}
\RequirePackage{calc}
\RequirePackage[titles]{tocloft}
\ifdefstring{\ELEGANT@lang}{cn}{
\renewcommand{\cftchappresnum}{\beforechap\space}
\renewcommand{\cftchapaftersnum}{\space\afterchap}
% \renewcommand{\cftchappresnum}{\beforechap\space}
% \renewcommand{\cftchapaftersnum}{\space\afterchap}
\setlength{\cftchapnumwidth}{\widthof{\textbf{附录~999}}}
\g@addto@macro\appendix{%
% recover \thechapter in the \NR@chapter's \numberline
\patchcmd{\NR@chapter}
{\numberline{\xchaptertitle}}
{\numberline{\thechapter}}{}{}
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
\protect\renewcommand{\protect\cftchapaftersnum}{}%