Debian Codegraph @

texmf-dist/doc/latex/nwafuthesis/nwafudoc.cls

raw
1 %%
2 %% This is file `nwafudoc.cls',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% nwafuthesis.dtx (with options: `doc')
8 %% nwafuthesis-doc.dtx (with options: `doc')
9 %%
10 %% Copyright (C) 2019--2026 by Nan Geng <[email protected]>
11 %%
12 %% This work may be distributed and/or modified under the
13 %% conditions of the LaTeX Project Public License, either
14 %% version 1.3c of this license or (at your option) any later
15 %% version. The latest version of this license is in:
16 %%
17 %% http://www.latex-project.org/lppl.txt
18 %%
19 %% and version 1.3 or later is part of all distributions of
20 %% LaTeX version 2005/12/01 or later.
21 %%
22 %% This work has the LPPL maintenance status `maintained'.
23 %%
24 %% The Current Maintainer of this work is Nan Geng.
25 %%
26 %% This work consists of the files nwafuthesis.dtx,
27 %% nwafuthesis-doc.dtx,
28 %% and the derived files nwafuthesis.ins,
29 %% nwafuthesis.cls,
30 %% nwafudoc.cls,
31 %%
32 \NeedsTeXFormat{LaTeX2e}
33 \RequirePackage{expl3}
34 \GetIdInfo $Id: nwafuthesis.dtx 2.16 2026-05-16 Nan Geng <[email protected]> $
35 {Documentation class for nwafuthesis}
36 \ProvidesExplClass{nwafudoc}
37 {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
38
39 \ExplSyntaxOff
40 \@namedef{[email protected]}{9999/99/99}
41 \LoadClass[a4paper, full]{l3doc}
42 \RequirePackage[heading, sub3section]{ctex}
43 \RequirePackage[sort&compress]{gbt7714}
44 \RequirePackage{
45 caption,
46 geometry,
47 graphicx,
48 listings,
49 makecell,
50 siunitx,
51 tabularx,
52 threeparttable,
53 unicode-math,
54 xcolor,
55 xcolor-material,
56 xunicode,
57 zref-base
58 }
59 \def\macro@code{%
60 \topsep \MacrocodeTopsep
61 \@beginparpenalty \predisplaypenalty
62 \partopsep \z@skip
63 \trivlist \parskip \z@ \item[]%
64 \MacroFont
65 \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
66 \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
67 \blank@linefalse \def\par{\ifblank@line
68 \leavevmode\fi
69 \blank@linetrue\@@par
70 \penalty\interlinepenalty}
71 \obeylines
72 \let\do\do@noligs \verbatim@nolig@list
73 \let\do\@makeother \dospecials
74 \global\@newlistfalse
75 \global\@minipagefalse
76 \init@crossref}
77 \ExplSyntaxOn
78 \tl_new:N \l__nwafudoc_tmpa_tl
79 \tl_new:N \l__nwafudoc_tmpb_tl
80 \cs_new_protected:Npn \__nwafudoc_patch_cmd:Nnn #1#2#3
81 {
82 \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3}
83 { } { \ctex_patch_failure:N #1 }
84 }
85 \cs_new_protected:Npn \__nwafudoc_preto_cmd:Nn #1#2
86 {
87 \ctex_preto_cmd:NnnTF #1 { } {#2}
88 { } { \ctex_patch_failure:N #1 }
89 }
90 \cs_new_protected:Npn \__nwafudoc_appto_cmd:Nn #1#2
91 {
92 \ctex_appto_cmd:NnnTF #1 { } {#2}
93 { } { \ctex_patch_failure:N #1 }
94 }
95 \cs_set_protected_nopar:Npn \xmacro@code
96 { \__nwafudoc_marco_code:w }
97 \cs_set_protected_nopar:Npn \sxmacro@code
98 {
99 \fontspec_print_visible_spaces:
100 \xmacro@code
101 }
102 \cs_new_protected_nopar:Npn \__nwafudoc_marco_code:w
103 {
104 \ifcodeline@index
105 \__nwafudoc_marco_code_every_par:n { \__nwafudoc_code_line_no: }
106 \else:
107 \__nwafudoc_marco_code_every_par:n { }
108 \fi:
109 \__nwafudoc_make_finish_tag:x { \@currenvir }
110 \__nwafudoc_macro_code_start:w
111 }
112 \cs_new_protected:Npn \__nwafudoc_marco_code_every_par:n #1
113 {
114 \everypar
115 {
116 \everypar {#1}
117 \if@inlabel
118 \global \@inlabelfalse \@noparlistfalse
119 \llap { \box \@labels \hskip \leftskip }
120 \fi
121 #1
122 }
123 }
124 \group_begin:
125 \int_set:Nn \tex_endlinechar:D { -1 }
126 \use:n
127 {
128 \char_set_catcode_active:n { 32 }
129 \tl_const:Nn \c__nwafudoc_active_space_tl
130 }
131 { }
132 \group_end:
133 \group_begin:
134 \char_set_catcode_active:n { 13 }
135 \cs_new_protected:Npx \__nwafudoc_make_finish_tag:n #1
136 {
137 \tl_set:Nn \exp_not:N \l__nwafudoc_macro_code_finish_tl
138 {
139 \c_percent_str
140 \prg_replicate:nn { 4 }
141 { \exp_not:o { \c__nwafudoc_active_space_tl } }
142 \exp_not:o { \active@escape@char } end
143 \c_left_brace_str #1 \c_right_brace_str
144 \exp_not:N ^^M
145 }
146 }
147 \cs_generate_variant:Nn \__nwafudoc_make_finish_tag:n { x }
148 \cs_new_protected:Npn \__nwafudoc_macro_code_start:w #1
149 {
150 \str_if_eq:nnTF {#1} { ^^M }
151 { \__nwafudoc_macro_code_read_line:w }
152 { \__nwafudoc_macro_code_read_line:w #1 }
153 }
154 \cs_new_protected:Npn \__nwafudoc_macro_code_read_line:w #1 ^^M
155 {
156 \tl_set:Nn \l__nwafudoc_macro_code_line_tl { #1 ^^M }
157 \tl_if_eq:NNTF
158 \l__nwafudoc_macro_code_line_tl \l__nwafudoc_macro_code_finish_tl
159 { \exp_args:Nx \end { \@currenvir } }
160 {
161 \__nwafudoc_macro_code_process_line:
162 \__nwafudoc_macro_code_read_line:w
163 }
164 }
165 \cs_new_protected:Npn \__nwafudoc_swap_cr:
166 {
167 \exp_after:wN
168 \__nwafudoc_swap_cr_aux:w \l__nwafudoc_macro_code_line_tl
169 }
170 \cs_new_protected:Npn \__nwafudoc_swap_cr_aux:w #1 ^^M
171 {
172 \group_insert_after:N ^^M
173 \tl_set:Nn \l__nwafudoc_macro_code_line_tl {#1}
174 }
175 \tl_const:Nn \c__nwafudoc_active_cr_tl { ^^M }
176 \group_end:
177 \tl_new:N \l__nwafudoc_macro_code_line_tl
178 \tl_new:N \l__nwafudoc_macro_code_finish_tl
179 \tl_new:N \g__nwafudoc_macro_code_verbatim_stop_tl
180 \cs_new_protected_nopar:Npn \__nwafudoc_process_normal_line:
181 {
182 \str_case_e:nnF
183 { \str_head:N \l__nwafudoc_macro_code_line_tl }
184 {
185 { \c_percent_str }
186 {
187 \__nwafudoc_check_angle:x
188 { \tl_tail:N \l__nwafudoc_macro_code_line_tl }
189 }
190 { \c_hash_str }
191 { \__nwafudoc_output_comment_line: }
192 }
193 { \__nwafudoc_output_line: }
194 }
195 \cs_new_protected_nopar:Npn \__nwafudoc_process_verbatim_line:
196 {
197 \tl_if_eq:NNTF \l__nwafudoc_macro_code_line_tl
198 \g__nwafudoc_macro_code_verbatim_stop_tl
199 {
200 \tl_gclear:N \g__nwafudoc_macro_code_verbatim_stop_tl
201 \cs_gset_eq:NN \__nwafudoc_macro_code_process_line:
202 \__nwafudoc_process_normal_line:
203 \__nwafudoc_output_module:nn
204 { \color { verb@guard } }
205 {
206 \__nwafudoc_swap_cr:
207 \__nwafudoc_module_pop:n { \l__nwafudoc_macro_code_line_tl }
208 }
209 }
210 { \tl_use:N \l__nwafudoc_macro_code_line_tl }
211 }
212 \cs_new_eq:NN \__nwafudoc_macro_code_process_line:
213 \__nwafudoc_process_normal_line:
214 \DeclareDocumentCommand \CheckModules { }
215 {
216 \cs_set_eq:NN \__nwafudoc_macro_code_process_line:
217 \__nwafudoc_process_normal_line:
218 }
219 \DeclareDocumentCommand \DontCheckModules { }
220 {
221 \cs_set_eq:NN \__nwafudoc_macro_code_process_line:
222 \__nwafudoc_output_line:
223 }
224 \cs_new_protected:Npn \__nwafudoc_check_angle:n #1
225 {
226 \str_if_eq:eeTF { \str_head:n {#1} } { < }
227 { \__nwafudoc_check_module:x { \tl_tail:n {#1} } }
228 { \__nwafudoc_output_comment_line: }
229 }
230 \cs_generate_variant:Nn \__nwafudoc_check_angle:n { x }
231 \cs_new_protected:Npn \__nwafudoc_check_module:n #1
232 {
233 \str_case_e:nnF { \str_head:n {#1} }
234 {
235 { * } { \__nwafudoc_module_star:w }
236 { / } { \__nwafudoc_module_slash:w }
237 { @ } { \__nwafudoc_module_at:w }
238 { < } { \__nwafudoc_module_verb:w }
239 }
240 { \__nwafudoc_module_pm:w }
241 #1 \q_stop
242 }
243 \cs_generate_variant:Nn \__nwafudoc_check_module:n { x }
244 \group_begin:
245 \char_set_catcode_active:N \>
246 \cs_new_protected:Npn \__nwafudoc_module_star:w #1 > #2 \q_stop
247 {
248 \tl_set:Nn \l__nwafudoc_tmpa_tl {#2}
249 \tl_if_eq:NNTF \l__nwafudoc_tmpa_tl \c__nwafudoc_active_cr_tl
250 {
251 \__nwafudoc_output_module:nn
252 { \__nwafudoc_star_color: }
253 {
254 \__nwafudoc_module_push:n
255 { \__nwafudoc_module_angle:n {#1} }
256 }
257 }
258 {
259 \__nwafudoc_output_module_left:nn
260 { \__nwafudoc_star_color: }
261 {
262 \__nwafudoc_module_push:n
263 { \__nwafudoc_module_angle:n {#1} }
264 }
265 }
266 \__nwafudoc_output_line:n {#2}
267 }
268 \cs_new_protected:Npn \__nwafudoc_module_slash:w #1 > #2 \q_stop
269 {
270 \tl_set:Nn \l__nwafudoc_tmpa_tl {#2}
271 \tl_if_eq:NNTF \l__nwafudoc_tmpa_tl \c__nwafudoc_active_cr_tl
272 {
273 \__nwafudoc_output_module:nn
274 { \__nwafudoc_slash_color: }
275 {
276 \__nwafudoc_module_pop:n
277 { \__nwafudoc_module_angle:n {#1} }
278 }
279 }
280 {
281 \__nwafudoc_output_module_left:nn
282 { \__nwafudoc_slash_color: }
283 {
284 \__nwafudoc_module_pop:n
285 { \__nwafudoc_module_angle:n {#1} }
286 }
287 }
288 \__nwafudoc_output_line:n {#2}
289 }
290 \cs_new_protected:Npn \__nwafudoc_module_at:w @ @ = #1 > #2 \q_stop
291 {
292 \__nwafudoc_output_module:nn
293 { \color { at@guard } }
294 { \__nwafudoc_module_angle:n { @ @ = #1 } }
295 \tl_gset:Nn \g__codedoc_module_name_tl {#1}
296 \__nwafudoc_output_line:n {#2}
297 }
298 \cs_new_protected:Npn \__nwafudoc_module_verb:w #1 \q_stop
299 {
300 \cs_gset_eq:NN \__nwafudoc_macro_code_process_line:
301 \__nwafudoc_process_verbatim_line:
302 \tl_gset:Nx \g__nwafudoc_macro_code_verbatim_stop_tl
303 { \c_percent_str \tl_tail:n {#1} }
304 \__nwafudoc_output_module:nn
305 { \color { verb@guard } }
306 {
307 \__nwafudoc_swap_cr:
308 \__nwafudoc_module_push:n { \l__nwafudoc_macro_code_line_tl }
309 }
310 }
311 \cs_new_protected:Npn \__nwafudoc_module_pm:w #1 > #2 \q_stop
312 {
313 \__nwafudoc_output_module_left:nn
314 { \__nwafudoc_pm_color: }
315 { \__nwafudoc_module_angle:n {#1} }
316 \__nwafudoc_output_line:n {#2}
317 }
318 \group_end:
319 \cs_new_protected:Npn \__nwafudoc_output_line:n #1
320 {
321 \tl_set:Nn \l__nwafudoc_macro_code_line_tl {#1}
322 \tl_if_eq:NNTF
323 \l__nwafudoc_macro_code_line_tl \c__nwafudoc_active_cr_tl
324 { \tl_use:N \l__nwafudoc_macro_code_line_tl }
325 {
326 \str_if_eq:eeTF
327 { \str_head:N \l__nwafudoc_macro_code_line_tl } { \c_percent_str }
328 { \__nwafudoc_output_comment_line: } { \__nwafudoc_output_line: }
329 }
330 }
331 \cs_new_protected_nopar:Npn \__nwafudoc_output_line:
332 {
333 \tex_noindent:D
334 \__nwafudoc_replace_at_at:N \l__nwafudoc_macro_code_line_tl
335 \tl_use:N \l__nwafudoc_macro_code_line_tl
336 }
337 \cs_new_protected:Npn \__nwafudoc_output_comment_line:
338 {
339 \tex_noindent:D
340 \group_begin:
341 \__nwafudoc_swap_cr:
342 \color { code@gray } \slshape \__nwafudoc_output_line:
343 \group_end:
344 }
345 \cs_new_protected:Npn \__nwafudoc_replace_at_at:N #1
346 {
347 \tl_if_empty:NF \g__codedoc_module_name_tl
348 { \__nwafudoc_replace_at_at_aux:No #1 \g__codedoc_module_name_tl }
349 }
350 \cs_new_protected:Npn \__nwafudoc_replace_at_at_aux:Nn #1#2
351 {
352 \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
353 \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 }
354 }
355 \cs_generate_variant:Nn \__nwafudoc_replace_at_at_aux:Nn { No }
356 \cs_new_protected_nopar:Npn \__nwafudoc_module_push:n
357 { \__nwafudoc_module_push_aux:on { \int_use:N \c@HD@hypercount } }
358 \cs_new_protected:Npn \__nwafudoc_module_push_aux:nn #1
359 {
360 \seq_gpush:Nn \g__nwafudoc_module_dest_seq {#1}
361 \hypersetup { hidelinks }
362 \exp_args:Nx \hdclindex
363 { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { }
364 }
365 \cs_generate_variant:Nn \__nwafudoc_module_push_aux:nn { on }
366 \cs_new_protected_nopar:Npn \__nwafudoc_module_pop:n
367 {
368 \seq_gpop:NNTF \g__nwafudoc_module_dest_seq \l__nwafudoc_tmpa_tl
369 { \__nwafudoc_module_pop_aux:on { \l__nwafudoc_tmpa_tl } }
370 { \BOOM \use:n }
371 }
372 \cs_new_protected:Npn \__nwafudoc_module_pop_aux:nn #1
373 {
374 \zref@labelbylist { HD.#1 } { nwafudoc }
375 \hypersetup { hidelinks }
376 \hdclindex {#1} { }
377 }
378 \cs_generate_variant:Nn \__nwafudoc_module_pop_aux:nn { on }
379 \seq_new:N \g__nwafudoc_module_dest_seq
380 \zref@newlist { nwafudoc }
381 \zref@newprop { guard@end } [ 1 ]
382 { \int_eval:n { \c@HD@hypercount - 1 } }
383 \zref@addprop { nwafudoc } { guard@end }
384 \cs_set_protected:Npn \MacroFont
385 {
386 \linespread { 1.05 }
387 \small \ttfamily \mdseries \upshape
388 \__nwafudoc_verb_addon:
389 }
390 \cs_new_protected:Npn \__nwafudoc_output_module:nn #1#2
391 {
392 \tex_noindent:D
393 \group_begin:
394 #1
395 \footnotesize \normalfont \sffamily #2
396 \group_end:
397 }
398 \cs_new_protected:Npn \__nwafudoc_output_module_left:nn #1#2
399 {
400 \tex_noindent:D
401 \hbox_overlap_left:n
402 {
403 \__nwafudoc_output_module:nn {#1} {#2}
404 \skip_horizontal:n { \leftskip + \smallskipamount }
405 }
406 }
407 \cs_new_protected_nopar:Npn \__nwafudoc_star_color:
408 {
409 \seq_gpop:NNTF \g__nwafudoc_star_color_seq \current@color
410 { \set@color }
411 { \__nwafudoc_select_color: }
412 \seq_gpush:No \g__nwafudoc_slash_color_seq { \current@color }
413 }
414 \cs_new_protected_nopar:Npn \__nwafudoc_slash_color:
415 {
416 \seq_gpop:NNTF \g__nwafudoc_slash_color_seq \current@color
417 {
418 \set@color
419 \seq_gpush:No \g__nwafudoc_star_color_seq { \current@color }
420 }
421 { \BOOM }
422 }
423 \cs_new_protected_nopar:Npn \__nwafudoc_pm_color:
424 {
425 \seq_get:NNTF \g__nwafudoc_star_color_seq \current@color
426 { \set@color }
427 {
428 \__nwafudoc_select_color:
429 \seq_gpush:No \g__nwafudoc_star_color_seq { \current@color }
430 }
431 }
432 \seq_new:N \g__nwafudoc_star_color_seq
433 \seq_new:N \g__nwafudoc_slash_color_seq
434 \cs_new_protected_nopar:Npn \__nwafudoc_select_color:
435 { \color { guard@series!!+ } }
436 \definecolorseries { guard@series }
437 { cmyk } { last } { blue } { purple }
438 \resetcolorseries [ 3 ] { guard@series }
439 \definecolor { verb@guard } { named } { MaterialLime600 }
440 \definecolor { at@guard } { named } { MaterialPink }
441 \definecolor { code@gray } { named } { MaterialGrey }
442 \cs_new_protected:Npn \__nwafudoc_module_angle:n #1
443 { < #1 > }
444 \cs_new_protected_nopar:Npn \__nwafudoc_code_line_no:
445 {
446 \int_gincr:N \c@CodelineNo
447 \hbox_overlap_left:n
448 {
449 \hbox_to_wd:nn
450 { \MacroIndent }
451 {
452 \HD@target
453 \tex_hss:D \__nwafudoc_code_line_no_style:
454 \theCodelineNo \enspace
455 }
456 \tex_kern:D \@totalleftmargin
457 }
458 }
459 \tl_set:Nn \theCodelineNo { \arabic { CodelineNo } }
460 \cs_new_protected_nopar:Npn \__nwafudoc_code_line_no_style:
461 { \color { code@gray } \normalfont \sffamily \tiny }
462 \cs_set_protected:Npn \HD@SetMacroIndent #1
463 {
464 \group_begin:
465 \settowidth \MacroIndent
466 {
467 \__nwafudoc_code_line_no_style:
468 \prg_replicate:nn { \tl_count:n {#1} } { 0 }
469 \enspace
470 }
471 \dim_gset_eq:NN \MacroIndent \MacroIndent
472 \group_end:
473 }
474 \sys_if_engine_xetex:TF
475 {
476 \cs_set_eq:NN \__nwafudoc_verb_addon: \xeCJKVerbAddon
477 \cs_set:Nn \__nwafudoc_plain_punct_style:
478 { \xeCJKsetup { PunctStyle = plain } }
479 \cs_set:Nn \__nwafudoc_disable_ecglue:
480 { \xeCJKsetup { CJKecglue } }
481 \__nwafudoc_appto_cmd:Nn \meta@font@select
482 { \mode_if_inner:T { \__nwafudoc_disable_ecglue: } }
483 }
484 {
485 \cs_set_eq:NN \__nwafudoc_verb_addon: \prg_do_nothing:
486 \cs_set_eq:NN \__nwafudoc_plain_punct_style: \prg_do_nothing:
487 \cs_set:Nn \__nwafudoc_disable_ecglue:
488 { \ltjsetparameter { autoxspacing = false } }
489 \__nwafudoc_appto_cmd:Nn \meta@font@select
490 { \__nwafudoc_disable_ecglue: }
491 }
492 \BeforeBeginEnvironment { function }
493 { \par \nointerlineskip }
494 \AtEndEnvironment { function }
495 {
496 \par
497 \cs_gset:Nx \__nwafudoc_fix_previous_depth:
498 { \prevdepth = \the \prevdepth \space }
499 }
500 \AfterEndEnvironment { function }
501 { \__nwafudoc_fix_previous_depth: }
502 \AtBeginEnvironment { syntax }
503 {
504 \linespread { 1.2 }
505 \__nwafudoc_plain_punct_style:
506 \__nwafudoc_disable_ecglue:
507 }
508 \AtBeginEnvironment { nwafusyntax }
509 {
510 \cs_set:Npn \lparen { \textup { ( } }
511 \cs_set:Npn \rparen { \textup { ) } }
512 \char_set_catcode_active:N |
513 \char_set_catcode_active:N <
514 \char_set_catcode_active:N (
515 \char_set_active_eq:NN | \orbar
516 \char_set_active_eq:NN < \syntaxopt@aux
517 \char_set_active_eq:NN ( \defaultval@aux
518 }
519 \cs_new_eq:NN \__nwafudoc_ltx_changes:nnn \changes@
520 \cs_set_protected:Npn \changes@ #1#2
521 {
522 \__nwafudoc_save_version_date:nn {#1} {#2}
523 \__nwafudoc_ltx_changes:nnn {#1} {#2}
524 }
525 \prop_new:N \g__nwafudoc_version_date_prop
526 \cs_new_protected:Npn \__nwafudoc_save_version_date:nn #1#2
527 {
528 \prop_get:NnNTF \g__nwafudoc_version_date_prop
529 {#1} \l__nwafudoc_tmpa_tl
530 {
531 \exp_after:wN
532 \__nwafudoc_save_version_date_aux:nnnn \l__nwafudoc_tmpa_tl
533 {#2} {#1}
534 }
535 { \__nwafudoc_save_version_date_aux:nnn {#1} {#2} {#2} }
536 }
537 \cs_new_protected:Npn \__nwafudoc_save_version_date_aux:nnnn #1#2#3#4
538 {
539 \__nwafudoc_if_date_later:nnTF {#1} {#3}
540 { \__nwafudoc_save_version_date_aux:nnn {#4} {#3} {#2} }
541 {
542 \__nwafudoc_if_date_later:nnT {#3} {#2}
543 { \__nwafudoc_save_version_date_aux:nnn {#4} {#1} {#3} }
544 }
545 }
546 \cs_new_protected:Npn \__nwafudoc_save_version_date_aux:nnn #1#2#3
547 { \prop_gput:Nnn \g__nwafudoc_version_date_prop {#1} { {#2} {#3} } }
548 \prg_new_conditional:Npnn \__nwafudoc_if_date_later:nn #1#2 { TF, T }
549 {
550 \if_int_compare:w
551 \__nwafudoc_parse_date:w #1 / / / 0 \q_stop >
552 \__nwafudoc_parse_date:w #2 / / / 0 \q_stop \exp_stop_f:
553 \prg_return_true:
554 \else:
555 \prg_return_false:
556 \fi:
557 }
558 \cs_new:Npn \__nwafudoc_parse_date:w #1/#2/#3/ #4 \q_stop
559 { #1#2#3 }
560 \cs_new_protected:Npn \CTEX@versionitem #1 \efill
561 {
562 \@idxitem
563 \prop_get:NnNTF \g__nwafudoc_version_date_prop
564 {#1} \l__nwafudoc_tmpa_tl
565 {
566 \exp_after:wN
567 \__nwafudoc_print_version_date:nnn \l__nwafudoc_tmpa_tl
568 {#1}
569 }
570 { \BOOM }
571 }
572 \cs_new_protected:Npn \__nwafudoc_print_version_date:nnn #1#2#3
573 {
574 \noindent
575 \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } }
576 \textbf {#3} \hfill
577 \hbox:n
578 {
579 \footnotesize
580 \str_if_eq:nnTF {#1} {#2}
581 { ( #1 ) } { ( #1 ~ -- ~ #2 ) }
582 }
583 \par \nopagebreak
584 }
585 \ctex_patch_cmd:Nnn \HDorg@theglossary
586 { \let \item \@idxitem }
587 { \let \item \CTEX@versionitem }
588 \ctex_patch_cmd:Nnn \@wrglossary
589 { hdpindex }
590 {
591 \ifnum \c@HD@hypercount = \z@
592 hdpindex
593 \else
594 hdclindex { \the \c@HD@hypercount }
595 \fi
596 }
597 \ctex_patch_cmd:Nnn \@addtocurcol
598 { \vskip \intextsep }
599 {
600 \edef \save@first@penalty { \the \lastpenalty } \unpenalty
601 \ifnum \lastpenalty = \@M
602 \unpenalty
603 \else
604 \penalty \save@first@penalty \relax
605 \fi
606 \ifnum \outputpenalty < -\@Mii
607 \addvspace\intextsep
608 \vskip\parskip
609 \else
610 \addvspace\intextsep
611 \fi
612 }
613 \ctex_patch_cmd:Nnn \@addtocurcol
614 {
615 \vskip \intextsep
616 \ifnum \outputpenalty < -\@Mii
617 \vskip -\parskip
618 \fi
619 }
620 {
621 \ifnum \outputpenalty < -\@Mii
622 \aftergroup \vskip \aftergroup \intextsep
623 \aftergroup \nointerlineskip
624 \else
625 \vskip \intextsep
626 \fi
627 }
628 \ctex_patch_cmd:Nnn \@getpen { \@M } { \@Mi }
629 \ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em }
630 \ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em }
631 \__nwafudoc_preto_cmd:Nn \@thehead
632 { \cs_set_eq:cN { MakeUppercase \space } \@iden }
633 \ctex_patch_cmd:Nnn \HDorg@thebibliography
634 { \section* } { \section }
635 \cs_set_eq:NN \thebibliography \HDorg@thebibliography
636 \__nwafudoc_appto_cmd:Nn \GlossaryParms
637 {
638 \raggedcolumns
639 \cs_set_eq:NN \Hy@writebookmark \HDorg@writebookmark
640 \cs_set:Npn \@idxitem { \par \hangindent 2em }
641 \cs_set:Npn \subitem { \@idxitem \hspace* { 1em } }
642 \cs_set:Npn \subsubitem { \@idxitem \hspace* { 2em } }
643 }
644 \ctex_patch_cmd:Nnn \HoLogo@LaTeXe
645 { \hbox { \HOLOGO@MathSetup 2 $ _{ \textstyle \varepsilon } $ } }
646 {
647 \hbox
648 {
649 \mathsurround 0pt \relax
650 2
651 \if b \expandafter \@car \f@series \@nil
652 $ _{ \textstyle \symbf { \varepsilon } } $
653 \else
654 $ _{ \textstyle \varepsilon } $
655 \fi
656 }
657 }
658 \ctex_patch_cmd:Nnn \NAT@citexnum
659 { - \NAT@penalty }
660 { \textendash \NAT@penalty }
661 \cs_set_eq:NN \list \__codedoc_oldlist:nn
662 \__nwafudoc_patch_cmd:Nnn \__codedoc_function_descr_start:w
663 { \noindent }
664 { \skip_vertical:n { -\parskip } \noindent }
665 \__nwafudoc_preto_cmd:Nn \__codedoc_function_assemble:
666 {
667 \box_if_empty:NTF \g__codedoc_syntax_box
668 { \skip_zero:N \medskipamount }
669 { \skip_add:Nn \medskipamount { \parskip } }
670 }
671 \__nwafudoc_patch_cmd:Nnn \__codedoc_typeset_functions:
672 { \small \ttfamily } { \footnotesize \ttfamily }
673 \__nwafudoc_patch_cmd:Nnn \__codedoc_typeset_expandability:
674 { & } { & \skip_horizontal:n { -0.5em } }
675 \__nwafudoc_preto_cmd:Nn \__codedoc_typeset_functions:
676 { \MacroFont }
677 \__nwafudoc_patch_cmd:Nnn \__codedoc_macro_init:
678 { \hbox:n } { \MacroFont \hbox:n }
679 \__nwafudoc_patch_cmd:Nnn \__codedoc_macro_dump:
680 { \hbox_unpack_drop:N } { \MacroFont \hbox_unpack_drop:N }
681 \__nwafudoc_patch_cmd:Nnn \__codedoc_meta_original:n
682 { \ensuremath \langle } { \textlangle }
683 \__nwafudoc_patch_cmd:Nnn \__codedoc_meta_original:n
684 { \ensuremath \rangle } { \textrangle }
685 \cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
686 \cs_set_protected:Npn \__codedoc_typeset_TF:
687 {
688 \group_begin:
689 \exp_args:No \__codedoc_if_macro_internal:nT \l__codedoc_tmpa_tl
690 { \color [ gray ] { 0.5 } }
691 \itshape TF
692 \makebox [ 0 pt ] [ r ]
693 {
694 \color { red }
695 \underline { \phantom { \itshape TF } \kern -0.1 em }
696 }
697 \group_end:
698 }
699 \cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
700 {
701 \vbox_set:Nn \l__codedoc_macro_box
702 {
703 \MacroFont
704 \vbox_unpack_drop:N \l__codedoc_macro_box
705 \hbox_set:Nn \l_tmpa_box
706 { \__codedoc_print_macroname:nN {#1} #2 }
707 \dim_set:Nn \l_tmpa_dim
708 { \marginparwidth - \labelsep - \marginparsep }
709 \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim
710 {
711 \box_resize_to_wd_and_ht:Nnn \l_tmpa_box
712 { \l_tmpa_dim } { \box_ht:N \l_tmpa_box }
713 }
714 \hbox_overlap_left:n
715 {
716 \box_use:N \l_tmpa_box
717 \skip_horizontal:n { \marginparsep - \labelsep }
718 }
719 }
720 \int_incr:N \l__codedoc_macro_int
721 }
722 \cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2
723 {
724 \strut
725 \__codedoc_get_hyper_target:eN
726 {
727 \exp_not:n {#1}
728 \bool_if:NT #2 { \tl_to_str:n {TF} }
729 }
730 \l__codedoc_tmpa_tl
731 \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl }
732 { \exp_args:NNo \label@hyperref [ \l__codedoc_tmpa_tl ] }
733 { \use:n }
734 {
735 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
736 \tl_replace_all:NVn \l__codedoc_tmpa_tl
737 { \c_catcode_other_space_tl }
738 { \fontspec_visible_space: }
739
740 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
741 \tl_replace_all:NVn \l__codedoc_tmpa_tl
742 { \c_catcode_other_space_tl }
743 { \fontspec_visible_space: }
744 \__codedoc_print_macroname_aux:on
745 \l__codedoc_tmpa_tl
746 { \bool_if:NT \l__codedoc_macro_TF_bool { \__codedoc_typeset_TF: } }
747 }
748 }
749 \cs_new_protected:Npn \__codedoc_special_index_aux:nnnnnnn #1#2#3#4#5#6#7
750 {
751 \tl_set:Nn \l__codedoc_index_escaped_key_tl {#1}
752 \__codedoc_quote_special_char:N \l__codedoc_index_escaped_key_tl
753 \__codedoc_special_index_set:Nn
754 \l__codedoc_index_escaped_macro_tl {#2}
755 \str_if_eq:onTF { \@currenvir } { macrocode }
756 { \codeline@wrindex }
757 {
758 \str_case:nnF {#7}
759 {
760 { main } { \codeline@wrindex }
761 { usage } { \index }
762 }
763 { \HD@target \index }
764 }
765 {
766 \tl_if_empty:nF { #3 #4 #5 #6 }
767 { #3 #5 \actualchar #4 #6 \levelchar }
768 \l__codedoc_index_escaped_key_tl
769 \actualchar
770 {
771 \token_to_str:N \verbatim@font \c_space_tl
772 \l__codedoc_index_escaped_macro_tl
773 }
774 \encapchar
775 hdclindex { \the \c@HD@hypercount } {#7}
776 }
777 }
778 \DeclareDocumentCommand \StopSpecialIndexModule { }
779 {
780 \cs_set_eq:NN
781 \__codedoc_special_index_module:nnnnN \use_none:nnnnn
782 }
783 \tl_map_inline:nn { \actualchar \encapchar \levelchar }
784 { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } }
785 \RenewDocumentCommand \meta { m }
786 {
787 \group_begin:
788 \sys_if_engine_xetex:T { \xeCJKsetup { CJKecglue = { } } }
789 \__codedoc_meta:n {#1}
790 \group_end:
791 }
792 \msg_redirect_name:nnn { l3doc } { foreign-internal } { log }
793 \msg_redirect_name:nnn { l3doc } { print-changes-howto } { log }
794 \msg_redirect_name:nnn { l3doc } { print-index-howto } { log }
795 \ExplSyntaxOff
796 \AtBeginDocument{%
797 \addtocontents{toc}{\StopSpecialIndexModule}}
798 \pdfstringdefDisableCommands{%
799 \let\path\meta
800 \let\opt\@firstofone}
801 \let\@multitoc@starttoc\@starttoc
802 \renewcommand*\@starttoc[1]{%
803 \begin{multicols}{2}%
804 \@multitoc@starttoc{#1}%
805 \end{multicols}}
806 \renewcommand\@makefntext[1]{\parindent 0em\noindent\@makefnmark~#1}
807 \IndexPrologue{%
808 \section{\indexname}%
809 \textit{意大利体的数字表示对应索引项出现的页码;
810 带下划线的数字表示定义对应索引项的代码行号;
811 其他则表示使用对应索引项的代码行号。}}
812 \def\IndexLayout{%
813 \newgeometry{
814 left = 0.85 in,
815 right = 0.85 in,
816 top = 1.25 in,
817 bottom = 1.00 in}%
818 \setlength\IndexMin{0.5\textheight}%
819 \ctexset{section/numbering=false}%
820 \StopSpecialIndexModule}
821 \def\indexname{代码索引}
822 \GlossaryPrologue{\section{\glossaryname}}
823 \def\glossaryname{修订记录}
824 \bibliographystyle{gbt7714-numerical}
825 \setmainfont{LibertinusSerif}[
826 Extension = .otf,
827 UprightFont = *-Regular,
828 BoldFont = *-Bold,
829 ItalicFont = *-Italic,
830 BoldItalicFont = *-BoldItalic,
831 Scale = 1.1]
832 \setsansfont{IBMPlexSansCondensed}[
833 Extension = .otf,
834 UprightFont = *-Regular,
835 BoldFont = *-Bold,
836 ItalicFont = *-Italic,
837 BoldItalicFont = *-BoldItalic]
838 \setmonofont{lmmonolt10}[
839 Extension = .otf,
840 UprightFont = *-regular,
841 BoldFont = *-bold,
842 ItalicFont = *-oblique,
843 BoldItalicFont = *-boldoblique]
844 \setmathfont{LibertinusMath-Regular.otf}
845
846 \setCJKmainfont{Source Han Serif SC}[ % 中文衬线字体,思源宋体
847 UprightFont = * SemiBold,
848 BoldFont = * Heavy,
849 ItalicFont = * Light,
850 BoldItalicFont = * Medium,
851 RawFeature = +fwid]
852 \setCJKsansfont{Source Han Sans SC}[ % 中文无衬线字体,思源宋体
853 UprightFont = * Medium,
854 BoldFont = * Heavy,
855 ItalicFont = * Light,
856 BoldItalicFont = * Normal,
857 RawFeature = +fwid]
858 \setCJKmonofont{Sarasa Mono SC}% 中文等宽字体,Sarasa Mono SC
859 \ctexset{
860 section/name = {第,节},
861 section/format+ = \raggedright,
862 paragraph/runin = false,
863 paragraph/numbering = false,
864 punct = kaiming}
865 \xeCJKsetwidth{·}{0.5em}
866 \setcounter{secnumdepth}{4}
867 \setcounter{tocdepth}{3}
868 \pagestyle{plain}
869 \sisetup{
870 inter-unit-product = \ensuremath{{}\cdot{}},
871 range-phrase = {--},
872 uncertainty-mode = separate}
873 \hypersetup{
874 bookmarksdepth = 4,
875 bookmarksnumbered = true,
876 colorlinks = true,
877 citecolor = MaterialGreen,
878 linkcolor = MaterialPink,
879 urlcolor = MaterialIndigo}
880 \captionsetup{labelsep=quad, font+=bf}
881 \newcolumntype{C}{>{\centering\arraybackslash}X}
882 \setlist{noitemsep, topsep=\smallskipamount}
883 \setlist[1]{labelindent=\parindent}
884 \setlist[enumerate]{leftmargin=*}
885 \setlist[itemize]{leftmargin=*}
886 \newlist{optdesc}{description}{3}
887 \setlist[optdesc]{
888 font = \mdseries\small\ttfamily,
889 align = right,
890 listparindent = \parindent,
891 labelsep = \marginparsep,
892 labelindent = -\marginparsep,
893 leftmargin = *}
894 \renewlist{tablenotes}{description}{1}
895 \setlist[tablenotes]{
896 format = \normalfont\itshape\tnote@item,
897 labelwidth = 0.5em,
898 itemindent = 0pt,
899 rightmargin = \tabcolsep,
900 leftmargin = \the\dimexpr\tabcolsep+1em\relax,
901 after = \@noparlisttrue}
902 \AtBeginEnvironment{tablenotes}{%
903 \setlength\parindent{2\ccwd}%
904 \normalfont\footnotesize}
905 \AtBeginEnvironment{threeparttable}{%
906 \stepcounter{tpt@id}%
907 \edef\curr@tpt@id{tpt@\arabic{tpt@id}}}
908 \newcounter{tpt@id}
909 \def\tnote@item#1{%
910 \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1}
911 \def\TPTtagStyle#1{\textit{\hyperlink{\curr@tpt@id-#1}{#1}}}
912 \def\UrlAlphabet{%
913 \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j%
914 \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
915 \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D%
916 \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
917 \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X%
918 \do\Y\do\Z}
919 \def\UrlDigits{%
920 \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0}
921 \g@addto@macro\UrlBreaks{\UrlOrds}
922 \g@addto@macro\UrlBreaks{\UrlAlphabet}
923 \g@addto@macro\UrlBreaks{\UrlDigits}
924 \DoNotIndex{\begin,\end,
925 \a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,
926 \n,\o,\p,\q,\r,\s,\t,\u,\v,\w,\x,\y,\z,
927 \A,\B,\C,\D,\E,\F,\G,\H,\I,\J,\K,\L,\M,
928 \N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z,
929 \0,\1,\2,\3,\4,\5,\6,\7,\8,\9}
930 \EnableCrossrefs
931 \CodelineIndex
932 \RecordChanges
933 \newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}}
934 \newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}}
935 \newcommand*\expstar{%
936 \hyperlink{expstar}{\textsuperscript{\rmfamily\scshape en}}}
937 \newcommand*\rexpstar{%
938 \hyperlink{rexpstar}{\textsuperscript{\rmfamily\scshape zh}}}
939 \ExplSyntaxOn
940 \cs_set_eq:NN \__codedoc_typeset_exp: \expstar
941 \cs_set_eq:NN \__codedoc_typeset_rexp: \rexpstar
942 \ExplSyntaxOff
943 \renewcommand*\marg[1]{\{\meta{#1}\}}
944 \renewcommand*\oarg[1]{[\meta{#1}]}
945 \renewcommand*\parg[1]{(\meta{#1})}
946 \DeclareDocumentCommand\opt{m}{\texttt{#1}}
947 \DeclareDocumentCommand\kvopt{mm}
948 {\texttt{#1\breakablethinspace=\breakablethinspace#2}}
949 \def\breakablethinspace{\hskip 0.16667em\relax}
950 \def\syntaxopt#1{\textit{#1}}
951 \def\defaultval#1{\textbf{\textup{#1}}}
952 \def\syntaxopt@aux#1>{\syntaxopt{#1}}
953 \def\defaultval@aux#1){\defaultval{#1}}
954 \def\orbar{\textup{\textbar}}
955 \def\TF{true\orbar false}
956 \def\TTF{\defaultval{true}\orbar false}
957 \def\TFF{true\orbar\defaultval{false}}
958 \DeclareDocumentEnvironment{arguments}{}
959 {\enumerate[label={\texttt{\#\arabic*:~}}, labelsep=0pt, nolistsep]}
960 {\endenumerate}
961 \def\TeX{\hologo{TeX}}
962 \def\LaTeX{\hologo{LaTeX}}
963 \def\LaTeXe{\hologo{LaTeXe}}
964 \def\pdfTeX{\hologo{pdfTeX}}
965 \def\pdfLaTeX{\hologo{pdfLaTeX}}
966 \def\XeTeX{\hologo{XeTeX}}
967 \def\XeLaTeX{\hologo{XeLaTeX}}
968 \def\LuaTeX{\hologo{LuaTeX}}
969 \def\LuaLaTeX{\hologo{LuaLaTeX}}
970 \def\AmSLaTeX{\hologo{AmSLaTeX}}
971 \def\TeXLive{\TeX\ Live}
972 \def\MiKTeX{\hologo{MiKTeX}}
973 \def\BibTeX{\hologo{BibTeX}}
974 \def\biber{\hologo{biber}}
975 \def\TikZ{Ti\emph{k}Z}
976 \lst@CCPutMacro\lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{-{}}}
977 \@empty\z@\@empty
978 \lstdefinestyle{style@base}{
979 basewidth = 0.525 em,
980 gobble = 3,
981 lineskip = 2 pt,
982 frame = l,
983 framerule = 1 pt,
984 framesep = 0 pt,
985 escapeinside = {(*}{*)},
986 basicstyle = \small\ttfamily\color{MaterialGrey900},
987 keywordstyle = \bfseries\color{MaterialIndigo},
988 commentstyle = \itshape\color{MaterialGrey600},
989 stringstyle = \color{MaterialRed},
990 backgroundcolor = \color{MaterialGrey50}
991 }
992 \lstdefinestyle{style@shell}{
993 style = style@base,
994 rulecolor = \color{MaterialPink},
995 language = bash,
996 alsoletter = {-},
997 emphstyle = \color{MaterialGreen800}
998 }
999 \lstdefinestyle{style@latex}{
1000 style = style@base,
1001 rulecolor = \color{MaterialIndigo},
1002 language = [LaTeX]TeX,
1003 alsoletter = {*, -},
1004 texcsstyle = *\color{MaterialDeepOrange},
1005 emphstyle = [1]\color{MaterialGreen800},
1006 emphstyle = [2]\color{MaterialTeal}
1007 }
1008 \lstdefinestyle{style@syntax}{
1009 basewidth = 0.525 em,
1010 gobble = 6,
1011 escapeinside = {(*}{*)},
1012 language = [LaTeX]TeX,
1013 alsoletter = {*, -},
1014 basicstyle = \footnotesize\ttfamily\color{MaterialGrey900},
1015 keywordstyle = \bfseries\color{MaterialIndigo},
1016 commentstyle = \itshape\color{MaterialGrey600},
1017 texcsstyle = *\color{MaterialDeepOrange},
1018 emphstyle = [1]\color{MaterialGreen800},
1019 emphstyle = [2]\color{MaterialTeal}
1020 }
1021 \lstnewenvironment{shellexample}[1][]{%
1022 \lstset{style=style@shell, #1}}{}
1023 \lstnewenvironment{latexexample}[1][]{%
1024 \lstset{style=style@latex, #1}}{}
1025 \lstnewenvironment{nwafusyntax}[1][]{%
1026 \lstset{style=style@syntax, #1}\vspace{-1.8ex}}{}
1027 \endinput
1028 %%
1029 %% End of file `nwafudoc.cls'.