mirror of
https://github.com/ElegantLaTeX/ElegantBook.git
synced 2026-01-26 04:14:35 +08:00
为兼容 2022/05/16 前的 hyperref 增加判断
This commit is contained in:
@@ -845,10 +845,20 @@
|
||||
\ifdefstring{\ELEGANT@scheme}{chinese}{
|
||||
\newcommand{\xchaptertitle}{第\zhnumber{\arabic{chapter}}章} }{
|
||||
\newcommand{\xchaptertitle}{第 \thechapter{} 章}}
|
||||
% Hyperref 2022/05/16's changelog.txt said
|
||||
% * nameref is loaded always and earlier (issue#235)
|
||||
\IfPackageAtLeastTF{hyperref}{2022/05/16}
|
||||
{
|
||||
\patchcmd{\NR@chapter}%
|
||||
{\numberline{\thechapter}}{\numberline{\xchaptertitle}}%
|
||||
{}{\fail}
|
||||
}
|
||||
{
|
||||
\patchcmd{\Hy@org@chapter}%
|
||||
{\numberline{\thechapter}}{\numberline{\xchaptertitle}}%
|
||||
{}{\fail}
|
||||
}
|
||||
}
|
||||
{\newcommand{\xchaptertitle}{\chaptername~\thechapter~}}
|
||||
|
||||
\setcounter{secnumdepth}{5}
|
||||
@@ -1381,9 +1391,17 @@ beforechap\newpage%
|
||||
\setlength{\cftchapnumwidth}{\widthof{\textbf{附录~999}}}
|
||||
\g@addto@macro\appendix{%
|
||||
% recover \thechapter in the \NR@chapter's \numberline
|
||||
\patchcmd{\NR@chapter}
|
||||
{\numberline{\xchaptertitle}}
|
||||
{\numberline{\thechapter}}{}{}
|
||||
\IfPackageAtLeastTF{hyperref}{2022/05/16}
|
||||
{
|
||||
\patchcmd{\NR@chapter}%
|
||||
{\numberline{\xchaptertitle}}{\numberline{\thechapter}}%
|
||||
{}{\fail}
|
||||
}
|
||||
{
|
||||
\patchcmd{\Hy@org@chapter}%
|
||||
{\numberline{\xchaptertitle}}{\numberline{\thechapter}}%
|
||||
{}{\fail}
|
||||
}
|
||||
\addtocontents{toc}{%
|
||||
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
|
||||
\protect\renewcommand{\protect\cftchapaftersnum}{}%
|
||||
|
||||
Reference in New Issue
Block a user