| 1 |
%% |
| 2 |
%% This is file `ctex-heading-beamer.def', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ctex.dtx (with options: `heading,beamer') |
| 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 beamer (CTEX)} |
| 29 |
\ProvidesExplFile{ctex-beamer.def} |
| 30 |
{\ExplFileDate}{2.5.10}{\ExplFileDescription} |
| 31 |
\seq_const_from_clist:Nn \c__ctex_headings_seq |
| 32 |
{ part , section , subsection } |
| 33 |
\cs_new_protected:Npn \__ctex_initial_heading:n #1 |
| 34 |
{ |
| 35 |
\tl_new:c { CTEX@pre#1 } |
| 36 |
\tl_new:c { CTEX@post#1 } |
| 37 |
\tl_const:cx { CTEXthe#1 } |
| 38 |
{ |
| 39 |
\exp_not:c { CTEX@pre#1 } |
| 40 |
\exp_not:c { CTEX@the#1 } |
| 41 |
\exp_not:c { CTEX@post#1 } |
| 42 |
} |
| 43 |
\tl_const:cx { CTEX@#1name } |
| 44 |
{ |
| 45 |
\group_begin: |
| 46 |
\exp_not:c { CTEX@#1@nameformat } |
| 47 |
{ |
| 48 |
\exp_not:c { CTEX@pre#1 } |
| 49 |
\exp_not:N \tl_if_empty:NTF |
| 50 |
\exp_not:c { CTEX@#1@numberformat } |
| 51 |
{ \exp_not:c { CTEX@the#1 } } |
| 52 |
{ |
| 53 |
\group_begin: |
| 54 |
\exp_not:c { CTEX@#1@numberformat } |
| 55 |
\exp_not:c { CTEX@the#1 } |
| 56 |
\group_end: |
| 57 |
} |
| 58 |
\exp_not:c { CTEX@post#1 } |
| 59 |
} |
| 60 |
\group_end: |
| 61 |
} |
| 62 |
} |
| 63 |
\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 |
| 64 |
{ |
| 65 |
\exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl |
| 66 |
{ |
| 67 |
#1 .meta:nn = { ctex / #1 } { ##1 } , |
| 68 |
#1 / name .code:n = |
| 69 |
{ \ctex_assign_heading_name:nn {#1} { ##1 } } , |
| 70 |
#1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , |
| 71 |
#1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , |
| 72 |
#1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , |
| 73 |
#1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , |
| 74 |
#1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , |
| 75 |
#1 / numbering .initial:n = true , |
| 76 |
#1 / beforeskip .initial:n = \c_zero_skip , |
| 77 |
#1 / afterskip .initial:n = \c_zero_skip , |
| 78 |
#1 / indent .initial:n = \c_zero_dim , |
| 79 |
#1 / beforeskip .value_required:n = true , |
| 80 |
#1 / afterskip .value_required:n = true , |
| 81 |
#1 / indent .value_required:n = true , |
| 82 |
\__ctex_plus_key_aux:nn {#1} { format } , |
| 83 |
\__ctex_plus_key_aux:nn {#1} { nameformat } , |
| 84 |
\__ctex_plus_key_aux:nn {#1} { numberformat } , |
| 85 |
\__ctex_plus_key_aux:nn {#1} { titleformat } , |
| 86 |
\__ctex_plus_key_aux:nn {#1} { aftername } , |
| 87 |
\__ctex_plus_key_aux:nn {#1} { aftertitle } , |
| 88 |
} |
| 89 |
} |
| 90 |
\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 |
| 91 |
{ |
| 92 |
#1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , |
| 93 |
#1 / #2 + .code:n = |
| 94 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } , |
| 95 |
#1 / #2 ~ + .code:n = |
| 96 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } |
| 97 |
} |
| 98 |
\NewDocumentCommand \ctex_assign_heading_name:nn |
| 99 |
{ m > { \SplitArgument { 1 } { , } } +m } |
| 100 |
{ \__ctex_assign_heading_name:nnn {#1} #2 } |
| 101 |
\cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 |
| 102 |
{ |
| 103 |
\tl_set:cn { CTEX@pre#1 } {#2} |
| 104 |
\tl_if_novalue:nTF {#3} |
| 105 |
{ \tl_clear:c { CTEX@post#1 } } |
| 106 |
{ \tl_set:cn { CTEX@post#1 } {#3} } |
| 107 |
} |
| 108 |
\group_begin: |
| 109 |
\tl_clear:N \l__ctex_tmp_tl |
| 110 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 111 |
{ |
| 112 |
\__ctex_initial_heading:n {#1} |
| 113 |
\__ctex_def_heading_keys:n {#1} |
| 114 |
} |
| 115 |
\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } |
| 116 |
\cs_new_protected:Npn \CTEX@heading@format@initial |
| 117 |
{ |
| 118 |
\normalfont |
| 119 |
\tl_clear:N \l__ctex_autoindent_tl |
| 120 |
\int_set:Nn \tex_interlinepenalty:D { 10 000 } |
| 121 |
\tex_noindent:D |
| 122 |
} |
| 123 |
\cs_new_protected:Npn \ctex_indent_box:n #1 |
| 124 |
{ |
| 125 |
\dim_set:Nn \tex_parindent:D {#1} |
| 126 |
\__ctex_insert_indent: |
| 127 |
} |
| 128 |
\cs_new_protected:Npn \__ctex_insert_indent: |
| 129 |
{ |
| 130 |
\dim_compare:nNnF \tex_parindent:D = \c_zero_dim |
| 131 |
{ \tex_indent:D } |
| 132 |
} |
| 133 |
\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n |
| 134 |
\ExplSyntaxOff |
| 135 |
\defbeamertemplate*{part page}{CTEX}[1][]{% |
| 136 |
\begingroup |
| 137 |
\par \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% |
| 138 |
\CTEX@heading@format@initial |
| 139 |
\CTEX@part@format{% |
| 140 |
\CTEX@indentbox{\CTEX@part@indent}% |
| 141 |
\ifodd \CTEX@part@numbering |
| 142 |
\CTEX@partname \CTEX@part@aftername |
| 143 |
\fi |
| 144 |
\begin{beamercolorbox}[sep=16pt,center,#1]{part title} |
| 145 |
\CTEX@part@titleformat \insertpart \CTEX@part@aftertitle |
| 146 |
\end{beamercolorbox}}% |
| 147 |
\par \addvspace{\glueexpr\CTEX@part@afterskip\relax}% |
| 148 |
\endgroup} |
| 149 |
\defbeamertemplate*{section page}{CTEX}[1][]{% |
| 150 |
\begingroup |
| 151 |
\par \addvspace{\glueexpr\CTEX@section@beforeskip\relax}% |
| 152 |
\CTEX@heading@format@initial |
| 153 |
\CTEX@section@format{% |
| 154 |
\CTEX@indentbox{\CTEX@section@indent}% |
| 155 |
\ifodd \CTEX@section@numbering |
| 156 |
\CTEX@sectionname \CTEX@section@aftername |
| 157 |
\fi |
| 158 |
\begin{beamercolorbox}[sep=12pt,center,#1]{part title} |
| 159 |
\CTEX@section@titleformat \insertsection \CTEX@section@aftertitle |
| 160 |
\end{beamercolorbox}}% |
| 161 |
\par \addvspace{\glueexpr\CTEX@section@afterskip\relax}% |
| 162 |
\endgroup} |
| 163 |
\defbeamertemplate*{subsection page}{CTEX}[1][]{% |
| 164 |
\begingroup |
| 165 |
\par \addvspace{\glueexpr\CTEX@subsection@beforeskip\relax}% |
| 166 |
\CTEX@heading@format@initial |
| 167 |
\CTEX@subsection@format{% |
| 168 |
\CTEX@indentbox{\CTEX@subsection@indent}% |
| 169 |
\ifodd \CTEX@subsection@numbering |
| 170 |
\CTEX@subsectionname \CTEX@subsection@aftername |
| 171 |
\fi |
| 172 |
\begin{beamercolorbox}[sep=8pt,center,#1]{part title} |
| 173 |
\CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle |
| 174 |
\end{beamercolorbox}}% |
| 175 |
\par \addvspace{\glueexpr\CTEX@subsection@afterskip\relax}% |
| 176 |
\endgroup} |
| 177 |
\defbeamertemplatealias{part page}{default}{CTEX} |
| 178 |
\defbeamertemplatealias{section page}{default}{CTEX} |
| 179 |
\defbeamertemplatealias{subsection page}{default}{CTEX} |
| 180 |
\ExplSyntaxOn |
| 181 |
\ctex_define:n |
| 182 |
{ |
| 183 |
tocdepth .code:n = \ctex_heading_depth:ne { tocdepth } {#1} , |
| 184 |
tocdepth .value_required:n = true |
| 185 |
} |
| 186 |
\cs_new_protected:Npn \ctex_heading_depth:nn #1#2 |
| 187 |
{ |
| 188 |
\prop_get:NnNTF \c__ctex_heading_level_prop {#2} \l__ctex_tmp_tl |
| 189 |
{ \setcounter {#1} { \l__ctex_tmp_tl } } |
| 190 |
{ \setcounter {#1} { \int_eval:n {#2} } } |
| 191 |
} |
| 192 |
\cs_generate_variant:Nn \ctex_heading_depth:nn { ne } |
| 193 |
\prop_const_from_keyval:Nn \c__ctex_heading_level_prop |
| 194 |
{ |
| 195 |
part = 0 , |
| 196 |
section = 1 , |
| 197 |
subsection = 2 , |
| 198 |
subsubsection = 3 , |
| 199 |
paragraph = 4 , |
| 200 |
subparagraph = 5 |
| 201 |
} |
| 202 |
\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 |
| 203 |
{ |
| 204 |
\protected@edef \@currentlabel |
| 205 |
{ |
| 206 |
\cs_if_exist:cTF { CTEX@the#1 } |
| 207 |
{ \exp_args:cc { p@#1 } { CTEX@the#1 } } |
| 208 |
{ \exp_not:o { \@currentlabel } } |
| 209 |
} |
| 210 |
} |
| 211 |
\cs_new_protected:Npn \ctex_varioref_hook: |
| 212 |
{ |
| 213 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 214 |
{ \ctex_fix_varioref_label:n { ##1 } } |
| 215 |
\ctex_at_end_package:nn { cleveref } { \ctex_cleveref_hook: } |
| 216 |
} |
| 217 |
\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 |
| 218 |
{ |
| 219 |
\tl_if_empty:cT { p@#1 } |
| 220 |
{ \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } |
| 221 |
} |
| 222 |
\cs_new_protected:Npn \ctex_cleveref_hook: |
| 223 |
{ |
| 224 |
\@ifpackageloaded { hyperref } |
| 225 |
{ |
| 226 |
\@ifpackagewith { hyperref } { implicit = false } |
| 227 |
{ } |
| 228 |
{ \__ctex_cleveref_hook_aux:N \H@refstepcounter } |
| 229 |
} |
| 230 |
{ |
| 231 |
\__ctex_cleveref_hook_aux:N \refstepcounter@noarg |
| 232 |
\__ctex_cleveref_hook_aux:N \refstepcounter@optarg |
| 233 |
} |
| 234 |
\__ctex_cleveref_hook_aux:N \appendix |
| 235 |
} |
| 236 |
\cs_new_protected:Npn \__ctex_cleveref_hook_aux:N #1 |
| 237 |
{ |
| 238 |
\ctex_patch_cmd_all:NnnnTF #1 |
| 239 |
{ |
| 240 |
\ExplSyntaxOff |
| 241 |
\char_set_catcode_letter:n { 64 } |
| 242 |
} |
| 243 |
{ \endcsname \csname the } |
| 244 |
{ \expandafter \endcsname \csname the } |
| 245 |
{ } |
| 246 |
{ \ctex_patch_failure:N #1 } |
| 247 |
} |
| 248 |
\cs_if_exist:NTF \labelformat |
| 249 |
{ \ctex_varioref_hook: } |
| 250 |
{ |
| 251 |
\cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter |
| 252 |
\RenewDocumentCommand \refstepcounter { m } |
| 253 |
{ |
| 254 |
\CTEX@save@refstepcounter {#1} |
| 255 |
\CTEX@setcurrentlabel@n {#1} |
| 256 |
} |
| 257 |
\ctex_at_end_package:nn { varioref } { \ctex_varioref_hook: } |
| 258 |
} |
| 259 |
\ctex_scheme_input:o { \l__ctex_scheme_tl } |
| 260 |
%% |
| 261 |
%% |
| 262 |
%% End of file `ctex-heading-beamer.def'. |