summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctex-book.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctex-book.def')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctex-book.def366
1 files changed, 268 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-book.def b/Master/texmf-dist/tex/latex/ctex/ctex-book.def
index 43125e9a69b..5978f8e9c95 100644
--- a/Master/texmf-dist/tex/latex/ctex/ctex-book.def
+++ b/Master/texmf-dist/tex/latex/ctex/ctex-book.def
@@ -26,16 +26,18 @@
%%
%% ------------------------------------------------------------------------------
%%
-\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $
{Heading modification for book (CTEX)}
\ProvidesExplFile{ctex-book.def}
- {\ExplFileDate}{2.1}{\ExplFileDescription}
+ {\ExplFileDate}{2.2}{\ExplFileDescription}
+
+\seq_new:N \c__ctex_section_headings_seq
+\seq_gset_from_clist:Nn \c__ctex_section_headings_seq
+ { section , subsection , subsubsection , paragraph , subparagraph }
\seq_new:N \c__ctex_headings_seq
-\seq_gset_from_clist:Nn \c__ctex_headings_seq
- {
- part , chapter , section , subsection , subsubsection ,
- paragraph , subparagraph
- }
+\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq
+\seq_gput_left:Nn \c__ctex_headings_seq { chapter }
+\seq_gput_left:Nn \c__ctex_headings_seq { part }
\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1
{
\tl_new:c { CTEX@pre#1 }
@@ -68,49 +70,53 @@
{
\tl_put_right:Nx \l__ctex_tmp_tl
{
- #1 .meta:nn = { ctex / #1 } { ####1 } ,
- #1 / name .code:n =
+ #1 .meta:nn = { ctex / #1 } { ####1 } ,
+ #1 / name .code:n =
{ \ctex_assign_heading_name:nn {#1} { ####1 } } ,
- #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } ,
- #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } ,
- #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } ,
- #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } ,
- #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } ,
- #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } ,
- #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } ,
- #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } ,
- #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} ,
- #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } ,
- #1 / format+ .code:n =
+ #1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } ,
+ #1 / format .tl_set:N = \exp_not:c { CTEX@#1@format } ,
+ #1 / nameformat .tl_set:N = \exp_not:c { CTEX@#1@nameformat } ,
+ #1 / numberformat .tl_set:N = \exp_not:c { CTEX@#1@numberformat } ,
+ #1 / aftername .tl_set:N = \exp_not:c { CTEX@#1@aftername } ,
+ #1 / titleformat .tl_set:N = \exp_not:c { CTEX@#1@titleformat } ,
+ #1 / aftertitle .tl_set:N = \exp_not:c { CTEX@#1@aftertitle } ,
+ #1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } ,
+ #1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} ,
+ #1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } ,
+ #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } ,
+ #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } ,
+ #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } ,
+ #1 / format+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } ,
- #1 / format~+ .code:n =
+ #1 / format~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } ,
- #1 / nameformat+ .code:n =
+ #1 / nameformat+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } ,
- #1 / nameformat~+ .code:n =
+ #1 / nameformat~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@nameformat } { ####1 } } ,
- #1 / numberformat+ .code:n =
+ #1 / numberformat+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } ,
- #1 / numberformat~+ .code:n =
+ #1 / numberformat~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@numberformat } { ####1 } } ,
- #1 / aftername+ .code:n =
+ #1 / aftername+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } ,
- #1 / aftername~+ .code:n =
+ #1 / aftername~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@aftername } { ####1 } } ,
- #1 / titleformat+ .code:n =
+ #1 / titleformat+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } ,
- #1 / titleformat~+ .code:n =
+ #1 / titleformat~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@titleformat } { ####1 } } ,
- #1 / aftertitle+ .code:n =
+ #1 / aftertitle+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } ,
- #1 / aftertitle~+ .code:n =
+ #1 / aftertitle~+ .code:n =
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@aftertitle } { ####1 } } ,
- #1 / beforeskip .initial:n = \c_zero_skip ,
- #1 / afterskip .initial:n = \c_zero_skip ,
- #1 / indent .initial:n = \c_zero_dim ,
- #1 / beforeskip .value_required: ,
- #1 / afterskip .value_required: ,
- #1 / indent .value_required: ,
+ #1 / numbering .initial:n = true ,
+ #1 / beforeskip .initial:n = \c_zero_skip ,
+ #1 / afterskip .initial:n = \c_zero_skip ,
+ #1 / indent .initial:n = \c_zero_dim ,
+ #1 / beforeskip .value_required: ,
+ #1 / afterskip .value_required: ,
+ #1 / indent .value_required: ,
}
}
\NewDocumentCommand \ctex_assign_heading_name:nn
@@ -135,20 +141,42 @@
}
\use:x { \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } }
\tl_clear:N \l__ctex_tmp_tl
-\def\@part[#1]#2{%
+\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { }
+\ctex_at_end_package:nn { hyperref }
+ { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } }
+\renewcommand\part{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
\thispagestyle{\CTEX@part@pagestyle}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \null\vskip \glueexpr \CTEX@part@beforeskip \relax
+ \secdef\@part\@spart}
+\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
- \refstepcounter{part}%
- \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
+ \ifodd \CTEX@part@numbering
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}%
+ \else
+ \CTEX@makeheadinganchor
+ \addcontentsline{toc}{part}{#1}%
+ \fi
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
{\interlinepenalty \@M
\normalfont \CTEX@part@format
- \ifnum \c@secnumdepth >-2\relax
+ \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering
\CTEX@partname
- \fi
+ \fi \fi
\CTEX@part@titleformat{#2}%
\CTEX@part@aftertitle}%
\@endpart}
@@ -158,13 +186,40 @@
\CTEX@part@titleformat{#1}%
\CTEX@part@aftertitle}%
\@endpart}
+\def\@endpart{%
+ \vskip \glueexpr \CTEX@part@afterskip \relax
+ \newpage
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{empty}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{\CTEX@chapter@pagestyle}%
+ \global\@topnum\z@
+ \ifodd \CTEX@chapter@afterindent
+ \@afterindenttrue
+ \else
+ \@afterindentfalse
+ \fi
+ \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\CTEXthechapter}%
- \addcontentsline{toc}{chapter}
- {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
+ \ifodd \CTEX@chapter@numbering
+ \refstepcounter{chapter}%
+ \typeout{\CTEXthechapter}%
+ \addcontentsline{toc}{chapter}
+ {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}%
+ \else
+ \CTEX@makeheadinganchor
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
@@ -181,42 +236,49 @@
\@afterheading
\fi}
\def\@makechapterhead#1{%
- \thispagestyle{\CTEX@chapter@pagestyle}%
- \@tempskipa \CTEX@chapter@beforeskip \relax
- \ifdim \@tempskipa <\z@
- \@tempskipa -\@tempskipa \@afterindentfalse
- \else
- \@afterindenttrue
- \fi
- \vspace*{\@tempskipa}%
- {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format
+ \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}%
+ {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
+ \CTEX@chapter@format
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
- \CTEX@chaptername
+ \ifodd \CTEX@chapter@numbering
+ \CTEX@chaptername
+ \fi
\fi
\fi
\interlinepenalty\@M
\CTEX@chapter@titleformat{#1}%
\CTEX@chapter@aftertitle
\nobreak
- \vskip \CTEX@chapter@afterskip
+ \vskip \glueexpr \CTEX@chapter@afterskip \relax
}}
\def\@makeschapterhead#1{%
- \thispagestyle{\CTEX@chapter@pagestyle}%
- \@tempskipa \CTEX@chapter@beforeskip \relax
- \ifdim \@tempskipa <\z@
- \@tempskipa -\@tempskipa \@afterindentfalse
- \else
- \@afterindenttrue
- \fi
- \vspace*{\@tempskipa}%
- {\normalfont \parindent \CTEX@chapter@indent \CTEX@chapter@format
+ \vspace*{\glueexpr\CTEX@chapter@beforeskip\relax}%
+ {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax
+ \CTEX@chapter@format
\interlinepenalty\@M
\CTEX@chapter@titleformat{#1}
\CTEX@chapter@aftertitle
\nobreak
- \vskip \CTEX@chapter@afterskip
+ \vskip \glueexpr \CTEX@chapter@afterskip \relax
}}
+\def\@startsection#1#2#3#4#5#6{%
+ \if@noskipsec \leavevmode \fi
+ \par
+ \CTEX@update@sectionformat@n{#1}%
+ \ifodd \CTEX@afterindent
+ \@afterindenttrue
+ \else
+ \@afterindentfalse
+ \fi
+ \if@nobreak
+ \everypar{}%
+ \else
+ \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}%
+ \fi
+ \@ifstar
+ {\@ssect{#3}{#4}{#5}{#6}}%
+ {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
\def\@seccntformat#1{%
\@ifundefined{CTEX@#1name}%
{\csname the#1\endcsname\quad}%
@@ -225,14 +287,18 @@
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
- \refstepcounter{#1}%
- \protected@edef\@svsec{\@seccntformat{#1}\relax}%
+ \ifodd \csname CTEX@#1@numbering\endcsname
+ \refstepcounter{#1}%
+ \protected@edef\@svsec{\@seccntformat{#1}\relax}%
+ \else
+ \CTEX@makeheadinganchor
+ \let\@svsec\@empty
+ \fi
\fi
- \@tempskipa #5\relax
- \ifdim \@tempskipa>\z@
+ \unless \ifodd \CTEX@runin
\begingroup
#6{%
- \@hangfrom{\hskip #3\relax\@svsec}%
+ \@hangfrom{\hskip\glueexpr #3\relax\@svsec}%
\interlinepenalty \@M
\csname CTEX@#1@titleformat\endcsname{#8}%
\csname CTEX@#1@aftertitle\endcsname}%
@@ -240,51 +306,80 @@
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
- \protect\numberline{\@ifundefined{CTEXthe#1}%
+ \ifodd \csname CTEX@#1@numbering\endcsname
+ \protect\numberline{\@ifundefined{CTEXthe#1}%
{\csname the#1\endcsname}%
{\csname CTEXthe#1\endcsname}}%
+ \fi
\fi
#7}%
\else
\def\@svsechd{%
- #6{\hskip #3\relax
+ #6{\hskip\glueexpr #3\relax
\@svsec
\csname CTEX@#1@titleformat\endcsname{#8}%
\csname CTEX@#1@aftertitle\endcsname}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
- \protect\numberline{\@ifundefined{CTEXthe#1}%
+ \ifodd \csname CTEX@#1@numbering\endcsname
+ \protect\numberline{\@ifundefined{CTEXthe#1}%
{\csname the#1\endcsname}%
{\csname CTEXthe#1\endcsname}}%
+ \fi
\fi
#7}}%
\fi
\@xsect{#5}}
\def\@ssect#1#2#3#4#5{%
- \@tempskipa #3\relax
- \ifdim \@tempskipa>\z@
+ \unless \ifodd \CTEX@runin
\begingroup
#4{%
- \@hangfrom{\hskip #1}%
+ \@hangfrom{\hskip\glueexpr #1\relax}%
\interlinepenalty \@M
\CTEX@titleformat@n{#5}%
\CTEX@aftertitle}%
\endgroup
\else
- \def\@svsechd{#4{\hskip #1\relax \CTEX@titleformat@n{#5}\CTEX@aftertitle}}%
+ \def\@svsechd{#4{\hskip\glueexpr #1\relax
+ \CTEX@titleformat@n{#5}\CTEX@aftertitle}}%
\fi
\@xsect{#3}}
-\cs_new_protected_nopar:Npn \CTEX@set@titleformat@n #1
+\def\@xsect#1{%
+ \unless \ifodd \CTEX@runin
+ \par \nobreak
+ \vskip\glueexpr #1\relax
+ \@afterheading
+ \else
+ \@nobreakfalse
+ \global\@noskipsectrue
+ \everypar{%
+ \if@noskipsec
+ \global\@noskipsecfalse
+ {\setbox\z@\lastbox}%
+ \clubpenalty\@M
+ \begingroup \@svsechd \endgroup
+ \unskip
+ \hskip\glueexpr #1\relax
+ \else
+ \clubpenalty \@clubpenalty
+ \everypar{}%
+ \fi}%
+ \fi
+ \ignorespaces}
+\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1
{
\cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat }
\cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle }
+ \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent }
+ \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin }
}
\cs_new_eq:NN \CTEX@titleformat@n \use:n
\cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing:
+\cs_new_eq:NN \CTEX@afterindent \c_true_bool
+\cs_new_eq:NN \CTEX@runin \c_false_bool
\int_zero:N \l__ctex_tmp_int
-\clist_map_inline:nn
- { section , subsection , subsubsection , paragraph , subparagraph }
+\seq_map_inline:Nn \c__ctex_section_headings_seq
{
\int_incr:N \l__ctex_tmp_int
\cs_gset_protected_nopar:cpx {#1}
@@ -294,18 +389,17 @@
{ \exp_not:c { CTEX@#1@indent } }
{ \exp_not:c { CTEX@#1@beforeskip } }
{ \exp_not:c { CTEX@#1@afterskip } }
- {
- \CTEX@set@titleformat@n {#1}
- \exp_not:N \normalfont \exp_not:c { CTEX@#1@format }
- }
+ { \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } }
}
}
\keys_define:nn { ctex }
{
- appendix .meta:nn = { ctex / appendix } {#1} ,
- appendix / name .code:n =
+ appendix .meta:nn = { ctex / appendix } {#1} ,
+ appendix / name .code:n =
{ \ctex_assign_heading_name:nn { appendix } {#1} } ,
- appendix / number .tl_set:N = \CTEX@appendixnumber
+ appendix / number .tl_set:N = \CTEX@appendix@number ,
+ appendix / numbering .bool_set:N = \CTEX@appendix@numbering ,
+ appendix / numbering .initial:n = true
}
\tl_new:N \CTEX@preappendix
\tl_new:N \CTEX@postappendix
@@ -314,8 +408,76 @@
{
\CTEX@save@appendix
\gdef \CTEX@prechapter { \CTEX@preappendix }
- \gdef \CTEX@thechapter { \CTEX@appendixnumber }
+ \gdef \CTEX@thechapter { \CTEX@appendix@number }
\gdef \CTEX@postchapter { \CTEX@postappendix }
+ \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering }
+ }
+\cs_new_protected_nopar:Npn \ctex_titlesec_hook:
+ {
+ \@ifpackagewith { titlesec } { explicit }
+ {
+ \cs_set_eq:NN \__ctex_titlesec_format:Nn
+ \__ctex_titlesec_format_explicit:Nn
+ }
+ { }
+ \clist_map_inline:nn
+ { indentafter , noindentafter , indentfirst , nonindentfirst }
+ {
+ \@ifpackagewith { titlesec } { ##1 }
+ {
+ \clist_map_break:n
+ { \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n }
+ }
+ { }
+ }
+ \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n
+ }
+\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1
+ {
+ \__ctex_titlesec_format:n {#1}
+ \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1}
+ }
+\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1
+ {
+ \cs_if_free:cF { ttlf@#1 }
+ { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} }
+ }
+\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2
+ {
+ \tl_set:Nx #1
+ {
+ \bool_if:cTF { CTEX@#2@runin }
+ { \exp_not:N \ttlh@runin }
+ { \exp_not:N \ttlh@hang }
+ \tl_tail:N #1
+ }
+ }
+\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2
+ {
+ \cs_set_nopar:Npx #1 ##1
+ {
+ \bool_if:cTF { CTEX@#2@runin }
+ { \exp_not:N \ttlh@runin }
+ { \exp_not:N \ttlh@hang }
+ \exp_args:No \tl_tail:n { #1 { } }
+ }
+ }
+\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2
+ { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } }
+\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6
+ {
+ \exp_not:n { {#1} {#2} {#3} {#4} }
+ { \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } }
+ }
+\@ifpackageloaded { titlesec }
+ { }
+ {
+ \ctex_at_end_package:nn { titlesec }
+ {
+ \@ifpackagewith { titlesec } { loadonly }
+ { }
+ { \ctex_titlesec_hook: }
+ }
}
\cs_new_protected:Npn \CTEX@toc@width@n #1
{
@@ -331,31 +493,39 @@
\use:n
{
\group_end:
- \ExplSyntaxOff
- \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { }
+ \ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff }
+ { \CTEX@toc@width@n {#1} }
+ { }
{ \ctex_patch_failure:N \numberline }
\@ifpackageloaded { tocloft }
{ }
{
\ctex_at_end_package:nn { tocloft }
{
- \ctex_preto_cmd:NnTF \numberline { \CTEX@toc@width@n {#1} } { }
+ \ctex_preto_cmd:NnnTF \numberline
+ { \char_set_catcode_letter:n { 64 } }
+ { \CTEX@toc@width@n {#1} }
+ { }
{ \ctex_patch_failure:N \numberline }
}
}
- \ExplSyntaxOn
}
\ctex_patch_cmd:Nnn \ps@headings
- { \@chapapp\ \thechapter.~\ } { \CTEXthechapter \quad }
+ { \@chapapp\ \thechapter.~\ }
+ { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi }
\if@twoside
- \ctex_patch_cmd:Nnn \ps@headings { \thesection.~\ } { \CTEXthesection \quad }
+ \ctex_patch_cmd:Nnn \ps@headings
+ { \thesection.~\ }
+ { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi }
\fi:
\ctex_at_end_package:nn { fancyhdr }
{
\ctex_patch_cmd:Nnn \ps@fancy
- { \@chapapp\ \thechapter.~\ } { \if@mainmatter \CTEXthechapter \quad \fi }
+ { \@chapapp\ \thechapter.~\ }
+ { \if@mainmatter \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi \fi }
\ctex_patch_cmd:Nnn \ps@fancy
- { \thesection.~\ } { \CTEXthesection \quad }
+ { \thesection.~\ }
+ { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi }
}
\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1
{