| 1 |
%% |
| 2 |
%% This is file `ctex-heading-report.def', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ctex.dtx (with options: `heading,report') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2003--2022 |
| 10 |
%% CTEX.ORG and any individual authors listed in the documentation. |
| 11 |
%% --------------------------------------------------------------------- |
| 12 |
%% |
| 13 |
%% This work may be distributed and/or modified under the |
| 14 |
%% conditions of the LaTeX Project Public License, either |
| 15 |
%% version 1.3c of this license or (at your option) any later |
| 16 |
%% version. This version of this license is in |
| 17 |
%% http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 18 |
%% and the latest version of this license is in |
| 19 |
%% http://www.latex-project.org/lppl.txt |
| 20 |
%% and version 1.3 or later is part of all distributions of |
| 21 |
%% LaTeX version 2005/12/01 or later. |
| 22 |
%% |
| 23 |
%% This work has the LPPL maintenance status "maintained". |
| 24 |
%% |
| 25 |
%% --------------------------------------------------------------------- |
| 26 |
%% |
| 27 |
\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <[email protected]> $ |
| 28 |
{Heading modification for report (CTEX)} |
| 29 |
\ProvidesExplFile{ctex-report.def} |
| 30 |
{\ExplFileDate}{2.5.10}{\ExplFileDescription} |
| 31 |
\seq_const_from_clist:Nn \c__ctex_section_headings_seq |
| 32 |
{ section , subsection , subsubsection , paragraph , subparagraph } |
| 33 |
\seq_new:N \c__ctex_headings_seq |
| 34 |
\seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq |
| 35 |
\seq_gput_left:Nn \c__ctex_headings_seq { chapter } |
| 36 |
\seq_gput_left:Nn \c__ctex_headings_seq { part } |
| 37 |
\cs_new_protected:Npn \__ctex_initial_heading:n #1 |
| 38 |
{ |
| 39 |
\tl_new:c { CTEX@pre#1 } |
| 40 |
\tl_new:c { CTEX@post#1 } |
| 41 |
\tl_const:cx { CTEXthe#1 } |
| 42 |
{ |
| 43 |
\exp_not:c { CTEX@pre#1 } |
| 44 |
\exp_not:c { CTEX@the#1 } |
| 45 |
\exp_not:c { CTEX@post#1 } |
| 46 |
} |
| 47 |
\tl_const:cx { CTEX@#1name } |
| 48 |
{ |
| 49 |
\group_begin: |
| 50 |
\exp_not:c { CTEX@#1@nameformat } |
| 51 |
{ |
| 52 |
\exp_not:c { CTEX@pre#1 } |
| 53 |
\exp_not:N \tl_if_empty:NTF |
| 54 |
\exp_not:c { CTEX@#1@numberformat } |
| 55 |
{ \exp_not:c { CTEX@the#1 } } |
| 56 |
{ |
| 57 |
\group_begin: |
| 58 |
\exp_not:c { CTEX@#1@numberformat } |
| 59 |
\exp_not:c { CTEX@the#1 } |
| 60 |
\group_end: |
| 61 |
} |
| 62 |
\exp_not:c { CTEX@post#1 } |
| 63 |
} |
| 64 |
\group_end: |
| 65 |
} |
| 66 |
} |
| 67 |
\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 |
| 68 |
{ |
| 69 |
\exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl |
| 70 |
{ |
| 71 |
#1 .meta:nn = { ctex / #1 } { ##1 } , |
| 72 |
#1 / name .code:n = |
| 73 |
{ \ctex_assign_heading_name:nn {#1} { ##1 } } , |
| 74 |
#1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , |
| 75 |
#1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , |
| 76 |
#1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , |
| 77 |
#1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , |
| 78 |
#1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , |
| 79 |
#1 / numbering .initial:n = true , |
| 80 |
#1 / beforeskip .initial:n = \c_zero_skip , |
| 81 |
#1 / afterskip .initial:n = \c_zero_skip , |
| 82 |
#1 / indent .initial:n = \c_zero_dim , |
| 83 |
#1 / beforeskip .value_required:n = true , |
| 84 |
#1 / afterskip .value_required:n = true , |
| 85 |
#1 / indent .value_required:n = true , |
| 86 |
#1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , |
| 87 |
#1 / fixskip .bool_set:N = \exp_not:c { CTEX@#1@fixskip } , |
| 88 |
#1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , |
| 89 |
#1 / hang .initial:n = true , |
| 90 |
#1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , |
| 91 |
#1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline } ##1##2 , |
| 92 |
\__ctex_plus_key_aux:nn {#1} { break } , |
| 93 |
\__ctex_plus_key_aux:nn {#1} { format } , |
| 94 |
\__ctex_plus_key_aux:nn {#1} { nameformat } , |
| 95 |
\__ctex_plus_key_aux:nn {#1} { numberformat } , |
| 96 |
\__ctex_plus_key_aux:nn {#1} { titleformat } , |
| 97 |
\__ctex_plus_key_aux:nn {#1} { aftername } , |
| 98 |
\__ctex_plus_key_aux:nn {#1} { aftertitle } , |
| 99 |
} |
| 100 |
} |
| 101 |
\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 |
| 102 |
{ |
| 103 |
#1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , |
| 104 |
#1 / #2 + .code:n = |
| 105 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } , |
| 106 |
#1 / #2 ~ + .code:n = |
| 107 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } |
| 108 |
} |
| 109 |
\NewDocumentCommand \ctex_assign_heading_name:nn |
| 110 |
{ m > { \SplitArgument { 1 } { , } } +m } |
| 111 |
{ \__ctex_assign_heading_name:nnn {#1} #2 } |
| 112 |
\cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 |
| 113 |
{ |
| 114 |
\tl_set:cn { CTEX@pre#1 } {#2} |
| 115 |
\tl_if_novalue:nTF {#3} |
| 116 |
{ \tl_clear:c { CTEX@post#1 } } |
| 117 |
{ \tl_set:cn { CTEX@post#1 } {#3} } |
| 118 |
} |
| 119 |
\group_begin: |
| 120 |
\tl_set:Nn \l__ctex_tmp_tl |
| 121 |
{ |
| 122 |
part / pagestyle .tl_set:N = \CTEX@part@pagestyle , |
| 123 |
chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , |
| 124 |
chapter / lofskip .tl_set:N = \CTEX@chapter@lofskip , |
| 125 |
chapter / lotskip .tl_set:N = \CTEX@chapter@lotskip , |
| 126 |
chapter / lofskip .initial:n = \c_zero_skip , |
| 127 |
chapter / lotskip .initial:n = \c_zero_skip , |
| 128 |
chapter / lofskip .value_required:n = true , |
| 129 |
chapter / lotskip .value_required:n = true , |
| 130 |
} |
| 131 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 132 |
{ |
| 133 |
\__ctex_initial_heading:n {#1} |
| 134 |
\__ctex_def_heading_keys:n {#1} |
| 135 |
} |
| 136 |
\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } |
| 137 |
\cs_new_protected:Npn \CTEX@heading@format@initial |
| 138 |
{ |
| 139 |
\normalfont |
| 140 |
\tl_clear:N \l__ctex_autoindent_tl |
| 141 |
\int_set:Nn \tex_interlinepenalty:D { 10 000 } |
| 142 |
\tex_noindent:D |
| 143 |
} |
| 144 |
\cs_new_protected:Npn \ctex_indent_box:n #1 |
| 145 |
{ |
| 146 |
\dim_set:Nn \tex_parindent:D {#1} |
| 147 |
\__ctex_insert_indent: |
| 148 |
} |
| 149 |
\cs_new_protected:Npn \__ctex_insert_indent: |
| 150 |
{ |
| 151 |
\dim_compare:nNnF \tex_parindent:D = \c_zero_dim |
| 152 |
{ \tex_indent:D } |
| 153 |
} |
| 154 |
\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n |
| 155 |
\cs_new_protected:Npn \CTEX@fixtopskip |
| 156 |
{ |
| 157 |
\CTEX@fixheadingskip |
| 158 |
\dim_compare:nNnF \tex_pagegoal:D < \c_max_dim |
| 159 |
{ \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } } |
| 160 |
} |
| 161 |
\cs_new_protected:Npn \CTEX@fixheadingskip |
| 162 |
{ |
| 163 |
\par |
| 164 |
\dim_set:Nn \tex_prevdepth:D { -1000pt } |
| 165 |
\skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } |
| 166 |
} |
| 167 |
\skip_new:N \l__ctex_heading_skip |
| 168 |
\cs_new_protected:Npn \CTEX@setheadingskip |
| 169 |
{ \skip_set:Nn \l__ctex_heading_skip } |
| 170 |
\cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip |
| 171 |
\cs_new_protected:Npn \CTEX@setthispagestyle #1 |
| 172 |
{ \exp_args:Ne \thispagestyle { \use:c { CTEX@#1@pagestyle } } } |
| 173 |
\ProvideDocumentCommand \partmark { m } |
| 174 |
{ \markboth { } { } } |
| 175 |
\cs_new_eq:NN \CTEXifname \use_ii:nn |
| 176 |
\cs_new_protected:Npn \CTEX@ifnametrue |
| 177 |
{ \cs_set_eq:NN \CTEXifname \use_i:nn } |
| 178 |
\cs_new_protected:Npn \CTEX@ifnamefalse |
| 179 |
{ \cs_set_eq:NN \CTEXifname \use_ii:nn } |
| 180 |
\cs_new_protected:Npn \CTEX@addloflotskip #1 |
| 181 |
{ |
| 182 |
\skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } } |
| 183 |
\skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } |
| 184 |
{ |
| 185 |
\addtocontents { lof } |
| 186 |
{ \protect \addvspace { \skip_use:N \l__ctex_heading_skip } } |
| 187 |
} |
| 188 |
\skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lotskip } } |
| 189 |
\skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } |
| 190 |
{ |
| 191 |
\addtocontents { lot } |
| 192 |
{ \protect \addvspace { \skip_use:N \l__ctex_heading_skip } } |
| 193 |
} |
| 194 |
} |
| 195 |
\cs_new_protected:Npn \CTEX@addtocline #1#2 |
| 196 |
{ \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } |
| 197 |
\renewcommand\part{% |
| 198 |
\CTEX@part@break |
| 199 |
\CTEX@setthispagestyle{part}% |
| 200 |
\if@twocolumn |
| 201 |
\onecolumn |
| 202 |
\@tempswatrue |
| 203 |
\else |
| 204 |
\@tempswafalse |
| 205 |
\fi |
| 206 |
\CTEX@setheadingskip \CTEX@part@beforeskip |
| 207 |
\ifodd \CTEX@part@fixskip \CTEX@fixtopskip \fi |
| 208 |
\vspace*{\CTEX@headingskip}% |
| 209 |
\secdef\@part\@spart} |
| 210 |
\def\@part[#1]#2{% |
| 211 |
\ifnum \c@secnumdepth >-2\relax |
| 212 |
\ifodd \CTEX@part@numbering |
| 213 |
\CTEX@ifnametrue |
| 214 |
\refstepcounter{part}% |
| 215 |
\else |
| 216 |
\CTEX@ifnamefalse |
| 217 |
\CTEX@makeanchor{part*}% |
| 218 |
\fi |
| 219 |
\else |
| 220 |
\CTEX@ifnamefalse |
| 221 |
\CTEX@makeanchor{part*}% |
| 222 |
\fi |
| 223 |
\CTEX@gettitle{#1}% |
| 224 |
\CTEX@addtocline{part}{#1}% |
| 225 |
\partmark{#1}% |
| 226 |
\begingroup |
| 227 |
\CTEX@heading@format@initial |
| 228 |
\CTEX@part@format{% |
| 229 |
\CTEX@headinghang{part}% |
| 230 |
{\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% |
| 231 |
\CTEX@part@titleformat{#2}% |
| 232 |
\CTEX@part@aftertitle}\par |
| 233 |
\endgroup |
| 234 |
\@endpart} |
| 235 |
\def\@spart#1{% |
| 236 |
\CTEX@ifnamefalse |
| 237 |
\CTEX@makeanchor@spart{part*}% |
| 238 |
\CTEX@gettitle{#1}% |
| 239 |
\begingroup |
| 240 |
\CTEX@heading@format@initial |
| 241 |
\CTEX@part@format{% |
| 242 |
\CTEX@headinghang{part}{}% |
| 243 |
\CTEX@part@titleformat{#1}% |
| 244 |
\CTEX@part@aftertitle}\par |
| 245 |
\endgroup |
| 246 |
\@endpart} |
| 247 |
\def\@endpart{% |
| 248 |
\CTEX@setheadingskip \CTEX@part@afterskip |
| 249 |
\ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi |
| 250 |
\vskip \CTEX@headingskip |
| 251 |
\newpage |
| 252 |
\if@twoside |
| 253 |
\if@openright |
| 254 |
\null |
| 255 |
\thispagestyle{empty}% |
| 256 |
\newpage |
| 257 |
\fi |
| 258 |
\fi |
| 259 |
\if@tempswa |
| 260 |
\twocolumn |
| 261 |
\fi} |
| 262 |
\renewcommand\chapter{% |
| 263 |
\CTEX@chapter@break |
| 264 |
\CTEX@setthispagestyle{chapter}% |
| 265 |
\global\@topnum\z@ |
| 266 |
\ifodd \CTEX@chapter@afterindent |
| 267 |
\@afterindenttrue |
| 268 |
\else |
| 269 |
\@afterindentfalse |
| 270 |
\fi |
| 271 |
\secdef\@chapter\@schapter} |
| 272 |
\def\@chapter[#1]#2{% |
| 273 |
\ifnum \c@secnumdepth >\m@ne |
| 274 |
\ifodd \CTEX@chapter@numbering |
| 275 |
\CTEX@ifnametrue |
| 276 |
\refstepcounter{chapter}% |
| 277 |
\typeout{\CTEXthechapter}% |
| 278 |
\else |
| 279 |
\CTEX@ifnamefalse |
| 280 |
\CTEX@makeanchor{\Hy@chapapp*}% |
| 281 |
\fi |
| 282 |
\else |
| 283 |
\CTEX@ifnamefalse |
| 284 |
\CTEX@makeanchor@chapter{\Hy@chapapp*}% |
| 285 |
\fi |
| 286 |
\CTEX@gettitle{#1}% |
| 287 |
\CTEX@addtocline{chapter}{#1}% |
| 288 |
\chaptermark{#1}% |
| 289 |
\CTEX@addloflotskip{chapter}% |
| 290 |
\if@twocolumn |
| 291 |
\@topnewpage[\@makechapterhead{#2}]% |
| 292 |
\else |
| 293 |
\@makechapterhead{#2}% |
| 294 |
\@afterheading |
| 295 |
\fi} |
| 296 |
\def\@schapter#1{% |
| 297 |
\CTEX@ifnamefalse |
| 298 |
\CTEX@makeanchor@schapter{\Hy@chapapp*}% |
| 299 |
\CTEX@gettitle{#1}% |
| 300 |
\if@twocolumn |
| 301 |
\@topnewpage[\@makeschapterhead{#1}]% |
| 302 |
\else |
| 303 |
\@makeschapterhead{#1}% |
| 304 |
\@afterheading |
| 305 |
\fi} |
| 306 |
\def\@makechapterhead#1{% |
| 307 |
\CTEX@setheadingskip \CTEX@chapter@beforeskip |
| 308 |
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi |
| 309 |
\vspace*{\CTEX@headingskip}% |
| 310 |
\begingroup |
| 311 |
\CTEX@heading@format@initial |
| 312 |
\CTEX@chapter@format{% |
| 313 |
\CTEX@headinghang{chapter}% |
| 314 |
{\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% |
| 315 |
\CTEX@chapter@titleformat{#1}% |
| 316 |
\CTEX@chapter@aftertitle}\par |
| 317 |
\endgroup |
| 318 |
\nobreak |
| 319 |
\CTEX@setheadingskip \CTEX@chapter@afterskip |
| 320 |
\ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi |
| 321 |
\vskip \CTEX@headingskip} |
| 322 |
\def\@makeschapterhead#1{% |
| 323 |
\CTEX@setheadingskip \CTEX@chapter@beforeskip |
| 324 |
\ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi |
| 325 |
\vspace*{\CTEX@headingskip}% |
| 326 |
\begingroup |
| 327 |
\CTEX@heading@format@initial |
| 328 |
\CTEX@chapter@format{% |
| 329 |
\CTEX@headinghang{chapter}{}% |
| 330 |
\CTEX@chapter@titleformat{#1}% |
| 331 |
\CTEX@chapter@aftertitle}\par |
| 332 |
\endgroup |
| 333 |
\nobreak |
| 334 |
\CTEX@setheadingskip \CTEX@chapter@afterskip |
| 335 |
\ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi |
| 336 |
\vskip \CTEX@headingskip} |
| 337 |
\def\@startsection#1#2#3#4#5#6{% |
| 338 |
\if@noskipsec \leavevmode \fi |
| 339 |
\par |
| 340 |
\CTEX@update@sectionformat@n{#1}% |
| 341 |
\ifodd \CTEX@afterindent |
| 342 |
\@afterindenttrue |
| 343 |
\else |
| 344 |
\@afterindentfalse |
| 345 |
\fi |
| 346 |
\if@nobreak |
| 347 |
\everypar{}% |
| 348 |
\else |
| 349 |
\csname CTEX@#1@break\endcsname |
| 350 |
\CTEX@setheadingskip{#4}% |
| 351 |
\ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi |
| 352 |
\addvspace \CTEX@headingskip |
| 353 |
\fi |
| 354 |
\@ifstar |
| 355 |
{\CTEX@makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}% |
| 356 |
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} |
| 357 |
\def\@seccntformat#1{% |
| 358 |
\csname CTEX@#1name\endcsname |
| 359 |
\csname CTEX@#1@aftername\endcsname} |
| 360 |
\def\@sect#1#2#3#4#5#6[#7]#8{% |
| 361 |
\ifnum #2>\c@secnumdepth |
| 362 |
\CTEX@ifnamefalse |
| 363 |
\CTEX@makeanchor@sect{#1*}% |
| 364 |
\let\@svsec\@empty |
| 365 |
\else |
| 366 |
\ifodd \csname CTEX@#1@numbering\endcsname |
| 367 |
\CTEX@ifnametrue |
| 368 |
\refstepcounter{#1}% |
| 369 |
\protected@edef\@svsec{\@seccntformat{#1}\relax}% |
| 370 |
\else |
| 371 |
\CTEX@ifnamefalse |
| 372 |
\CTEX@makeanchor{#1*}% |
| 373 |
\let\@svsec\@empty |
| 374 |
\fi |
| 375 |
\fi |
| 376 |
\CTEX@gettitle{#7}% |
| 377 |
\unless \ifodd \CTEX@runin |
| 378 |
\begingroup |
| 379 |
\CTEX@heading@format@initial |
| 380 |
#6{% |
| 381 |
\CTEX@sectionhang{#3}{\@svsec}% |
| 382 |
\csname CTEX@#1@titleformat\endcsname{#8}% |
| 383 |
\csname CTEX@#1@aftertitle\endcsname}\par |
| 384 |
\endgroup |
| 385 |
\csname #1mark\endcsname{#7}% |
| 386 |
\CTEX@addtocline{#1}{#7}% |
| 387 |
\else |
| 388 |
\def\@svsechd{% |
| 389 |
#6{% |
| 390 |
{\CTEX@indentbox{#3}}\@svsec |
| 391 |
\csname CTEX@#1@titleformat\endcsname{#8}% |
| 392 |
\csname CTEX@#1@aftertitle\endcsname}% |
| 393 |
\csname #1mark\endcsname{#7}% |
| 394 |
\CTEX@addtocline{#1}{#7}}% |
| 395 |
\fi |
| 396 |
\@xsect{#5}} |
| 397 |
\def\@ssect#1#2#3#4#5{% |
| 398 |
\CTEX@ifnamefalse |
| 399 |
\CTEX@gettitle{#5}% |
| 400 |
\unless \ifodd \CTEX@runin |
| 401 |
\begingroup |
| 402 |
\CTEX@heading@format@initial |
| 403 |
#4{% |
| 404 |
\CTEX@sectionhang{#1}{}% |
| 405 |
\CTEX@titleformat@n{#5}% |
| 406 |
\CTEX@aftertitle}\par |
| 407 |
\endgroup |
| 408 |
\else |
| 409 |
\def\@svsechd{#4{{\CTEX@indentbox{#1}}% |
| 410 |
\CTEX@titleformat@n{#5}\CTEX@aftertitle}}% |
| 411 |
\fi |
| 412 |
\@xsect{#3}} |
| 413 |
\def\@xsect#1{% |
| 414 |
\unless \ifodd \CTEX@runin |
| 415 |
\par \nobreak |
| 416 |
\CTEX@setheadingskip{#1}% |
| 417 |
\ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi |
| 418 |
\vskip \CTEX@headingskip |
| 419 |
\@afterheading |
| 420 |
\else |
| 421 |
\@nobreakfalse |
| 422 |
\global\@noskipsectrue |
| 423 |
\everypar{% |
| 424 |
\if@noskipsec |
| 425 |
\global\@noskipsecfalse |
| 426 |
{\setbox\z@\lastbox}% |
| 427 |
\clubpenalty\@M |
| 428 |
\begingroup \@svsechd \endgroup |
| 429 |
\unskip |
| 430 |
\CTEX@heading@glue{#1}% |
| 431 |
\else |
| 432 |
\clubpenalty \@clubpenalty |
| 433 |
\everypar{}% |
| 434 |
\fi}% |
| 435 |
\fi |
| 436 |
\ignorespaces} |
| 437 |
\cs_new_protected:Npn \CTEX@headinghang #1 |
| 438 |
{ |
| 439 |
\ctex_heading_hang:cnn |
| 440 |
{ CTEX@#1@hang } |
| 441 |
{ \use:c { CTEX@#1@indent } } |
| 442 |
} |
| 443 |
\cs_new_protected:Npn \CTEX@sectionhang |
| 444 |
{ \ctex_heading_hang:Nnn \CTEX@hang } |
| 445 |
\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 |
| 446 |
{ |
| 447 |
\dim_set:Nn \tex_parindent:D {#2} |
| 448 |
\bool_if:NTF #1 |
| 449 |
{ \ctex_hang_from:n } |
| 450 |
{ \use:n } |
| 451 |
{ \__ctex_insert_indent: #3 } |
| 452 |
} |
| 453 |
\cs_new_protected:Npn \ctex_hang_from:n #1 |
| 454 |
{ |
| 455 |
\tex_noindent:D |
| 456 |
\hbox_set:Nn \l__ctex_tmp_box {#1} |
| 457 |
\tex_hangindent:D = \box_wd:N \l__ctex_tmp_box |
| 458 |
\box_use_drop:N \l__ctex_tmp_box |
| 459 |
} |
| 460 |
\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } |
| 461 |
\cs_new_protected:Npn \ctex_heading_glue:n #1 |
| 462 |
{ |
| 463 |
\group_begin: |
| 464 |
\skip_set:Nn \l__ctex_heading_skip {#1} |
| 465 |
\dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim |
| 466 |
{ \skip_horizontal:N \l__ctex_heading_skip } |
| 467 |
\group_end: |
| 468 |
} |
| 469 |
\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n |
| 470 |
\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 |
| 471 |
{ |
| 472 |
\cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } |
| 473 |
\cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } |
| 474 |
\cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } |
| 475 |
\cs_set_eq:Nc \CTEX@fixskip { CTEX@#1@fixskip } |
| 476 |
\cs_set_eq:Nc \CTEX@hang { CTEX@#1@hang } |
| 477 |
\cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } |
| 478 |
} |
| 479 |
\cs_new_eq:NN \CTEX@titleformat@n \use:n |
| 480 |
\cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: |
| 481 |
\cs_new_eq:NN \CTEX@afterindent \c_true_bool |
| 482 |
\cs_new_eq:NN \CTEX@fixskip \c_false_bool |
| 483 |
\cs_new_eq:NN \CTEX@hang \c_true_bool |
| 484 |
\cs_new_eq:NN \CTEX@runin \c_false_bool |
| 485 |
\cs_new:Npn \CTEX@part@tocline #1#2 |
| 486 |
{ |
| 487 |
\CTEXifname |
| 488 |
{ \CTEXthepart \hspace { 1em } } |
| 489 |
{ } |
| 490 |
#2 |
| 491 |
} |
| 492 |
\cs_new:Npn \CTEX@chapter@tocline #1#2 |
| 493 |
{ |
| 494 |
\CTEXifname |
| 495 |
{ \protect \numberline { \CTEXthechapter \hspace { .3em } } } |
| 496 |
{ } |
| 497 |
#2 |
| 498 |
} |
| 499 |
\cs_new:Npn \CTEXnumberline #1 |
| 500 |
{ |
| 501 |
\CTEXifname |
| 502 |
{ \protect \numberline { \use:c { CTEXthe #1 } } } |
| 503 |
{ } |
| 504 |
} |
| 505 |
\int_zero:N \l__ctex_tmp_int |
| 506 |
\seq_map_inline:Nn \c__ctex_section_headings_seq |
| 507 |
{ |
| 508 |
\int_incr:N \l__ctex_tmp_int |
| 509 |
\cs_gset_protected:cpx {#1} |
| 510 |
{ |
| 511 |
\exp_not:N \@startsection {#1} |
| 512 |
{ \int_use:N \l__ctex_tmp_int } |
| 513 |
{ \exp_not:c { CTEX@#1@indent } } |
| 514 |
{ \exp_not:c { CTEX@#1@beforeskip } } |
| 515 |
{ \exp_not:c { CTEX@#1@afterskip } } |
| 516 |
{ \exp_not:N \normalfont \exp_not:c { CTEX@#1@format } } |
| 517 |
} |
| 518 |
\cs_new:cpn { CTEX@#1@tocline } ##1##2 |
| 519 |
{ \CTEXnumberline { ##1 } ##2 } |
| 520 |
} |
| 521 |
\ctex_define:n |
| 522 |
{ |
| 523 |
appendix .meta:nn = { ctex / appendix } {#1} , |
| 524 |
appendix / name .code:n = |
| 525 |
{ \ctex_assign_heading_name:nn { appendix } {#1} } , |
| 526 |
appendix / number .tl_set:N = \CTEX@appendix@number , |
| 527 |
appendix / numbering .bool_set:N = \CTEX@appendix@numbering , |
| 528 |
appendix / numbering .initial:n = true |
| 529 |
} |
| 530 |
\tl_new:N \CTEX@preappendix |
| 531 |
\tl_new:N \CTEX@postappendix |
| 532 |
\cs_new_eq:NN \CTEX@save@appendix \appendix |
| 533 |
\cs_gset_protected:Npn \appendix |
| 534 |
{ |
| 535 |
\CTEX@save@appendix |
| 536 |
\gdef \CTEX@prechapter { \CTEX@preappendix } |
| 537 |
\gdef \CTEX@thechapter { \CTEX@appendix@number } |
| 538 |
\gdef \CTEX@postchapter { \CTEX@postappendix } |
| 539 |
\gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } |
| 540 |
} |
| 541 |
\cs_new_protected:Npn \CTEX@makeanchor #1 |
| 542 |
{ } |
| 543 |
\seq_const_from_clist:Nn \c__ctex_headings_cs_seq |
| 544 |
{ part , spart , chapter , schapter , sect , ssect } |
| 545 |
\seq_map_inline:Nn \c__ctex_headings_cs_seq |
| 546 |
{ |
| 547 |
\cs_new_eq:cc { CTEX@ #1 } { @ #1 } |
| 548 |
\cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor |
| 549 |
} |
| 550 |
\cs_new_protected:Npn \CTEX@hyperheadinghook |
| 551 |
{ |
| 552 |
\group_begin: |
| 553 |
\legacy_if:nTF { Hy@implicit } |
| 554 |
{ |
| 555 |
\cs_set_eq:NN \H@old@chapter \Hy@org@chapter |
| 556 |
\seq_map_inline:Nn \c__ctex_headings_cs_seq |
| 557 |
{ |
| 558 |
\cs_if_eq:ccT { H@old@ ##1 } { CTEX@ ##1 } |
| 559 |
{ |
| 560 |
\cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 } |
| 561 |
\cs_gset_eq:cN { CTEX@makeanchor@ ##1 } \CTEX@makeanchor |
| 562 |
} |
| 563 |
} |
| 564 |
} |
| 565 |
{ |
| 566 |
\seq_map_inline:Nn \c__ctex_headings_cs_seq |
| 567 |
{ \cs_gset_eq:cN { CTEX@makeanchor@ ##1 } \CTEX@makeanchor } |
| 568 |
} |
| 569 |
\group_end: |
| 570 |
} |
| 571 |
\ctex_at_end_package:nn { hyperref } |
| 572 |
{ |
| 573 |
\cs_gset_protected:Npn \CTEX@makeanchor #1 |
| 574 |
{ |
| 575 |
\Hy@MakeCurrentHrefAuto {#1} |
| 576 |
\Hy@raisedlink |
| 577 |
{ |
| 578 |
\hyper@anchorstart { \@currentHref } |
| 579 |
\hyper@anchorend |
| 580 |
} |
| 581 |
} |
| 582 |
\CTEX@hyperheadinghook |
| 583 |
} |
| 584 |
\cs_new_protected:Npn \CTEX@gettitle #1 |
| 585 |
{ } |
| 586 |
\ctex_at_end_package:nn { nameref } |
| 587 |
{ |
| 588 |
\cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } |
| 589 |
\seq_map_inline:Nn \c__ctex_headings_cs_seq |
| 590 |
{ |
| 591 |
\cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } |
| 592 |
{ \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } |
| 593 |
} |
| 594 |
} |
| 595 |
\cs_new_protected:Npn \ctex_titlesec_hook: |
| 596 |
{ |
| 597 |
\@ifpackagewith { titlesec } { explicit } |
| 598 |
{ |
| 599 |
\cs_set_eq:NN \__ctex_titlesec_format:Nn |
| 600 |
\__ctex_titlesec_format_explicit:Nn |
| 601 |
} |
| 602 |
{ } |
| 603 |
\clist_map_inline:nn |
| 604 |
{ indentafter , noindentafter , indentfirst , nonindentfirst } |
| 605 |
{ |
| 606 |
\@ifpackagewith { titlesec } { ##1 } |
| 607 |
{ |
| 608 |
\clist_map_break:n |
| 609 |
{ \cs_set_eq:NN \__ctex_titlesec_hook:n \__ctex_titlesec_format:n } |
| 610 |
} |
| 611 |
{ } |
| 612 |
} |
| 613 |
\seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n |
| 614 |
} |
| 615 |
\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 |
| 616 |
{ |
| 617 |
\__ctex_titlesec_format:n {#1} |
| 618 |
\exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} |
| 619 |
} |
| 620 |
\cs_new_protected:Npn \__ctex_titlesec_format:n #1 |
| 621 |
{ |
| 622 |
\cs_if_free:cF { ttlf@#1 } |
| 623 |
{ \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } |
| 624 |
} |
| 625 |
\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 |
| 626 |
{ |
| 627 |
\tl_set:Nx #1 |
| 628 |
{ |
| 629 |
\bool_if:cTF { CTEX@#2@runin } |
| 630 |
{ \exp_not:N \ttlh@runin } |
| 631 |
{ \exp_not:N \ttlh@hang } |
| 632 |
\tl_tail:N #1 |
| 633 |
} |
| 634 |
} |
| 635 |
\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 |
| 636 |
{ |
| 637 |
\cs_set_nopar:Npx #1 ##1 |
| 638 |
{ |
| 639 |
\bool_if:cTF { CTEX@#2@runin } |
| 640 |
{ \exp_not:N \ttlh@runin } |
| 641 |
{ \exp_not:N \ttlh@hang } |
| 642 |
\exp_args:No \tl_tail:n { #1 { } } |
| 643 |
} |
| 644 |
} |
| 645 |
\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 |
| 646 |
{ \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } |
| 647 |
\cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 |
| 648 |
{ |
| 649 |
\exp_not:n { {#1} {#2} {#3} {#4} } |
| 650 |
{ \bool_if:cTF { CTEX@#6@afterindent } { \@ne } { \z@ } } |
| 651 |
} |
| 652 |
\@ifpackageloaded { titlesec } |
| 653 |
{ } |
| 654 |
{ |
| 655 |
\ctex_at_end_package:nn { titlesec } |
| 656 |
{ |
| 657 |
\@ifpackagewith { titlesec } { loadonly } |
| 658 |
{ } |
| 659 |
{ \ctex_titlesec_hook: } |
| 660 |
} |
| 661 |
} |
| 662 |
\ctex_at_end_package:nn { titlesec } |
| 663 |
{ |
| 664 |
\tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } |
| 665 |
\cs_if_free:NF \ttl@tocpart |
| 666 |
{ |
| 667 |
\cs_set_protected:Npn \ttl@tocpart |
| 668 |
{ \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } |
| 669 |
} |
| 670 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 671 |
{ |
| 672 |
\cs_if_exist:cF { ttl@toc #1 } |
| 673 |
{ |
| 674 |
\cs_new_protected:cpx { ttl@toc #1 } |
| 675 |
{ |
| 676 |
\tl_set:Nn \exp_not:N \ttl@a |
| 677 |
{ |
| 678 |
\exp_not:N \protect |
| 679 |
\exp_not:N \numberline { \exp_not:c { CTEXthe #1 } } |
| 680 |
} |
| 681 |
} |
| 682 |
} |
| 683 |
} |
| 684 |
} |
| 685 |
\ctex_at_end_package:nn { titlesec } |
| 686 |
{ |
| 687 |
\ctex_patch_cmd:Nnn \ttl@labelling |
| 688 |
{ \let \ifttl@toclabel \ifttl@label } |
| 689 |
{ |
| 690 |
\let \ifttl@toclabel \ifttl@label |
| 691 |
\CTEX@updatettlifname |
| 692 |
} |
| 693 |
\cs_new_protected:Npn \CTEX@updatettlifname |
| 694 |
{ \legacy_if:nTF { ttl@label } { \CTEX@ifnametrue } { \CTEX@ifnamefalse } } |
| 695 |
} |
| 696 |
\group_begin: |
| 697 |
\char_set_catcode_other:N \# |
| 698 |
\cs_new_protected:Npn \ctex_titleps_hook: |
| 699 |
{ |
| 700 |
\ctex_patch_cmd:Nnn \ttl@settopmark |
| 701 |
{ \protect \@namedef { the#1 } { \@nameuse { the#1 } } } |
| 702 |
{ |
| 703 |
\protect \@namedef { the#1 } { \@nameuse { the#1 } } |
| 704 |
\CTEX@titlepslabel@set {#1} |
| 705 |
} |
| 706 |
\ctex_patch_cmd:Nnn \ttl@setsubmark |
| 707 |
{ \protect \@namedef { the#1 } { } } |
| 708 |
{ |
| 709 |
\protect \@namedef { the#1 } { } |
| 710 |
\CTEX@titlepslabel@clear {#1} |
| 711 |
} |
| 712 |
\ctex_patch_cmd:Nnn \ttl@setsubmark |
| 713 |
{ \protect \@namedef { the#2 } { \@nameuse { the#2 } } } |
| 714 |
{ |
| 715 |
\protect \@namedef { the#2 } { \@nameuse { the#2 } } |
| 716 |
\CTEX@titlepslabel@set {#2} |
| 717 |
} |
| 718 |
} |
| 719 |
\group_end: |
| 720 |
\cs_new:Npn \CTEX@titlepslabel@set #1 |
| 721 |
{ |
| 722 |
\cs_if_free:cF { CTEXthe#1 } |
| 723 |
{ \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } |
| 724 |
} |
| 725 |
\cs_new:Npn \CTEX@titlepslabel@clear #1 |
| 726 |
{ |
| 727 |
\cs_if_free:cF { CTEXthe#1 } |
| 728 |
{ \protect \@namedef { CTEXthe#1 } { } } |
| 729 |
} |
| 730 |
\ctex_at_end_package:nn { titlesec } |
| 731 |
{ \cs_if_free:NF \ttl@settopmark { \ctex_titleps_hook: } } |
| 732 |
\ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } |
| 733 |
\ctex_at_end_package:nn { titleps } |
| 734 |
{ |
| 735 |
\cs_set_protected:Npn \ttl@setifthe #1 |
| 736 |
{ |
| 737 |
\exp_args:Nco \cs_set:Npn { ifthe #1 } |
| 738 |
{ |
| 739 |
\CTEXifname |
| 740 |
{ \protect \@firstoftwo } |
| 741 |
{ \protect \@secondoftwo } |
| 742 |
} |
| 743 |
} |
| 744 |
\seq_map_function:NN \c__ctex_headings_seq \ttl@setifthe |
| 745 |
} |
| 746 |
\cs_new_protected:Npn \CTEX@toc@width@n #1 |
| 747 |
{ |
| 748 |
\hbox_set:Nn \l__ctex_tmp_box {#1} |
| 749 |
\dim_set:Nn \@tempdima |
| 750 |
{ |
| 751 |
\dim_max:nn { \@tempdima } |
| 752 |
{ \box_wd:N \l__ctex_tmp_box + \f@size \p@ / 2 } |
| 753 |
} |
| 754 |
} |
| 755 |
\group_begin: |
| 756 |
\char_set_catcode_other:N \# |
| 757 |
\use:n |
| 758 |
{ |
| 759 |
\group_end: |
| 760 |
\ctex_preto_cmd:NnnTF \numberline { \ExplSyntaxOff } |
| 761 |
{ \CTEX@toc@width@n {#1} } |
| 762 |
{ } |
| 763 |
{ \ctex_patch_failure:N \numberline } |
| 764 |
\cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 |
| 765 |
{ |
| 766 |
\@ifpackageloaded { \c_parameter_token 1 } |
| 767 |
{ } |
| 768 |
{ |
| 769 |
\ctex_at_end_package:nn { \c_parameter_token 1 } |
| 770 |
{ |
| 771 |
\ctex_preto_cmd:NnnTF \numberline |
| 772 |
{ \char_set_catcode_letter:n { 64 } } |
| 773 |
{ \CTEX@toc@width@n {#1} } |
| 774 |
{ } |
| 775 |
{ \ctex_patch_failure:N \numberline } |
| 776 |
} |
| 777 |
} |
| 778 |
} |
| 779 |
} |
| 780 |
\__ctex_patch_toc_width:n { tocloft } |
| 781 |
\__ctex_patch_toc_width:n { titletoc } |
| 782 |
\ctex_patch_cmd:Nnn \ps@headings |
| 783 |
{ |
| 784 |
\ifnum \c@secnumdepth > \m@ne |
| 785 |
\@chapapp \ \thechapter . ~ \ % |
| 786 |
\fi |
| 787 |
} |
| 788 |
{ \CTEXifname { \CTEXthechapter \quad } { } } |
| 789 |
\legacy_if:nT { @twoside } |
| 790 |
{ |
| 791 |
\ctex_patch_cmd:Nnn \ps@headings |
| 792 |
{ \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } |
| 793 |
{ \CTEXifname { \CTEXthesection \quad } { } } |
| 794 |
} |
| 795 |
\ctex_at_end_package:nn { fancyhdr } |
| 796 |
{ |
| 797 |
\ctex_patch_cmd:Nnn \f@nch@initialise |
| 798 |
{ \ifnum \c@secnumdepth > \z@ \thesection \hskip 1em \relax \fi } |
| 799 |
{ \CTEXifname { \CTEXthesection \quad } { } } |
| 800 |
\ctex_patch_cmd:Nnn \f@nch@initialise |
| 801 |
{ \ifnum \c@secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi } |
| 802 |
{ \CTEXifname { \CTEXthesubsection \quad } { } } |
| 803 |
\ctex_patch_cmd:Nnn \f@nch@initialise |
| 804 |
{ \ifnum \c@secnumdepth > \m@ne \@chapapp\ \thechapter . ~ \ \fi } |
| 805 |
{ \CTEXifname { \CTEXthechapter \quad } { } } |
| 806 |
\ctex_patch_cmd:Nnn \f@nch@initialise |
| 807 |
{ \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } |
| 808 |
{ \CTEXifname { \CTEXthesection \quad } { } } |
| 809 |
\f@nch@initialise |
| 810 |
\@ifpackagewith { fancyhdr } { headings } |
| 811 |
{ |
| 812 |
\ctex_patch_cmd:Nnn \ps@headings |
| 813 |
{ |
| 814 |
\ifnum \c@secnumdepth > \m@ne |
| 815 |
\@chapapp \ \thechapter . ~ \ % |
| 816 |
\fi |
| 817 |
} |
| 818 |
{ \CTEXifname { \CTEXthechapter \quad } { } } |
| 819 |
\legacy_if:nT { @twoside } |
| 820 |
{ |
| 821 |
\ctex_patch_cmd:Nnn \ps@headings |
| 822 |
{ \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } |
| 823 |
{ \CTEXifname { \CTEXthesection \quad } { } } |
| 824 |
} |
| 825 |
} |
| 826 |
{ } |
| 827 |
} |
| 828 |
\ctex_define:n |
| 829 |
{ |
| 830 |
secnumdepth .code:n = \ctex_heading_depth:ne { secnumdepth } {#1} , |
| 831 |
secnumdepth .value_required:n = true , |
| 832 |
tocdepth .code:n = \ctex_heading_depth:ne { tocdepth } {#1} , |
| 833 |
tocdepth .value_required:n = true |
| 834 |
} |
| 835 |
\cs_new_protected:Npn \ctex_heading_depth:nn #1#2 |
| 836 |
{ |
| 837 |
\prop_get:NnNTF \c__ctex_heading_level_prop {#2} \l__ctex_tmp_tl |
| 838 |
{ \setcounter {#1} { \l__ctex_tmp_tl } } |
| 839 |
{ \setcounter {#1} { \int_eval:n {#2} } } |
| 840 |
} |
| 841 |
\cs_generate_variant:Nn \ctex_heading_depth:nn { ne } |
| 842 |
\prop_const_from_keyval:Nn \c__ctex_heading_level_prop |
| 843 |
{ |
| 844 |
part = -1 , |
| 845 |
chapter = 0 , |
| 846 |
section = 1 , |
| 847 |
subsection = 2 , |
| 848 |
subsubsection = 3 , |
| 849 |
paragraph = 4 , |
| 850 |
subparagraph = 5 |
| 851 |
} |
| 852 |
\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 |
| 853 |
{ |
| 854 |
\protected@edef \@currentlabel |
| 855 |
{ |
| 856 |
\cs_if_exist:cTF { CTEX@the#1 } |
| 857 |
{ \exp_args:cc { p@#1 } { CTEX@the#1 } } |
| 858 |
{ \exp_not:o { \@currentlabel } } |
| 859 |
} |
| 860 |
} |
| 861 |
\cs_new_protected:Npn \ctex_varioref_hook: |
| 862 |
{ |
| 863 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 864 |
{ \ctex_fix_varioref_label:n { ##1 } } |
| 865 |
\ctex_at_end_package:nn { cleveref } { \ctex_cleveref_hook: } |
| 866 |
} |
| 867 |
\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 |
| 868 |
{ |
| 869 |
\tl_if_empty:cT { p@#1 } |
| 870 |
{ \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } |
| 871 |
} |
| 872 |
\cs_new_protected:Npn \ctex_cleveref_hook: |
| 873 |
{ |
| 874 |
\@ifpackageloaded { hyperref } |
| 875 |
{ |
| 876 |
\@ifpackagewith { hyperref } { implicit = false } |
| 877 |
{ } |
| 878 |
{ \__ctex_cleveref_hook_aux:N \H@refstepcounter } |
| 879 |
} |
| 880 |
{ |
| 881 |
\__ctex_cleveref_hook_aux:N \refstepcounter@noarg |
| 882 |
\__ctex_cleveref_hook_aux:N \refstepcounter@optarg |
| 883 |
} |
| 884 |
\__ctex_cleveref_hook_aux:N \appendix |
| 885 |
} |
| 886 |
\cs_new_protected:Npn \__ctex_cleveref_hook_aux:N #1 |
| 887 |
{ |
| 888 |
\ctex_patch_cmd_all:NnnnTF #1 |
| 889 |
{ |
| 890 |
\ExplSyntaxOff |
| 891 |
\char_set_catcode_letter:n { 64 } |
| 892 |
} |
| 893 |
{ \endcsname \csname the } |
| 894 |
{ \expandafter \endcsname \csname the } |
| 895 |
{ } |
| 896 |
{ \ctex_patch_failure:N #1 } |
| 897 |
} |
| 898 |
\cs_if_exist:NTF \labelformat |
| 899 |
{ \ctex_varioref_hook: } |
| 900 |
{ |
| 901 |
\cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter |
| 902 |
\RenewDocumentCommand \refstepcounter { m } |
| 903 |
{ |
| 904 |
\CTEX@save@refstepcounter {#1} |
| 905 |
\CTEX@setcurrentlabel@n {#1} |
| 906 |
} |
| 907 |
\ctex_at_end_package:nn { varioref } { \ctex_varioref_hook: } |
| 908 |
} |
| 909 |
\ctex_scheme_input:o { \l__ctex_scheme_tl } |
| 910 |
%% |
| 911 |
%% |
| 912 |
%% End of file `ctex-heading-report.def'. |