Skip to content

Commit e7e92ed

Browse files
committed
Declare unexpandable functions as protected
1 parent 3dd6844 commit e7e92ed

2 files changed

Lines changed: 48 additions & 35 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
latexmk -${{ matrix.engine }} -halt-on-error -jobname="%A-${{ matrix.engine }}" thesis-*.tex
4242
4343
- name: Upload PDFs
44-
uses: actions/upload-artifact@v6
44+
uses: actions/upload-artifact@v7
4545
with:
4646
name: test-${{ matrix.engine }}
4747
path: test/*.pdf

sysuthesis.dtx

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,15 @@ To produce the documentation run the original source files ending with
139139
}
140140
}{}
141141
\ExplSyntaxOn
142-
\cs_new:Nn \__syntax_bar: { \textup { \textbar } }
143-
\cs_new:Npn \__syntax_opt:n #1 { \textsl { #1 } }
144-
\cs_new:Npn \__syntax_def:n #1 { \textbf { \textup { #1 } } }
145-
\cs_new:Npn \__syntax_opt_aux:n #1>
142+
\cs_new_protected:Npn \__syntax_bar:
143+
{ \textup { \textbar } }
144+
\cs_new_protected:Npn \__syntax_opt:n #1
145+
{ \textsl { #1 } }
146+
\cs_new_protected:Npn \__syntax_def:n #1
147+
{ \textbf { \textup { #1 } } }
148+
\cs_new_protected:Npn \__syntax_opt_aux:n #1>
146149
{ \__syntax_opt:n { \ensuremath { \langle } #1 \ensuremath { \rangle } } }
147-
\cs_new:Npn \__syntax_def_aux:n #1)
150+
\cs_new_protected:Npn \__syntax_def_aux:n #1)
148151
{ \__syntax_def:n { #1 } }
149152
\hook_gput_code:nnn { env / syntax / begin } { . }
150153
{
@@ -174,6 +177,7 @@ To produce the documentation run the original source files ending with
174177
% \date{2026/02/06\quad v1.0.0}
175178
%
176179
% \changes{v0.1.0}{2025/04/30}{进行模板编写。}
180+
% \changes{v1.1.0}{2026/04/10}{将不能完全展开的函数声明为 protected。}
177181
%
178182
% \maketitle
179183
%
@@ -978,11 +982,20 @@ To produce the documentation run the original source files ending with
978982
%
979983
% \subsubsection{内部函数}
980984
%
981-
% \begin{macro}{\@@_quad:, \@@_qquad:}
985+
% \begin{macro}{\@@_quad:}
982986
% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。
983987
% \begin{macrocode}
984-
\cs_new:Npn \@@_quad: { \skip_horizontal:n { 1 em } }
985-
\cs_new:Npn \@@_qquad: { \skip_horizontal:n { 2 em } }
988+
\cs_new_protected:Npn \@@_quad: { \skip_horizontal:n { 1 em } }
989+
% \end{macrocode}
990+
% \end{macro}
991+
%
992+
% \begin{macro}{\@@_hss:, \@@_hfill}
993+
% 等价于 \LaTeXe{} 中的 \tn{hss} 和 \tn{hfill}。
994+
% \begin{macrocode}
995+
\cs_new_protected:Npn \@@_hss:
996+
{ \skip_horizontal:n { 0pt plus 1fil minus 1fil } }
997+
\cs_new_protected:Npn \@@_hfill:
998+
{ \skip_horizontal:n { 0pt plus 1fill } }
986999
% \end{macrocode}
9871000
% \end{macro}
9881001
%
@@ -993,10 +1006,10 @@ To produce the documentation run the original source files ending with
9931006
% \begin{macrocode}
9941007
\cs_new_protected:Npn \@@_vskip:N #1
9951008
{
996-
\tex_hrule:D \@height \c_zero_dim \scan_stop:
1009+
\tex_hrule:D height \c_zero_dim
9971010
\tex_penalty:D \@M
9981011
\skip_vertical:N #1
999-
\skip_vertical:N \c_zero_dim
1012+
\skip_vertical:N \c_zero_skip
10001013
}
10011014
% \end{macrocode}
10021015
% \end{macro}
@@ -1013,14 +1026,14 @@ To produce the documentation run the original source files ending with
10131026
\mode_leave_vertical:
10141027
\rule [ -0.8 ex ] { #1 } { 0.5 pt }
10151028
\skip_horizontal:n { -#1 }
1016-
\hbox_to_wd:nn { #1 } { \tex_hss:D #2 \tex_hss:D }
1029+
\hbox_to_wd:nn { #1 } { \@@_hss: #2 \@@_hss: }
10171030
}
10181031
\cs_new_protected:Npn \@@_box_ulined:nN #1#2
10191032
{
10201033
\mode_leave_vertical:
10211034
\rule [ -0.8 ex ] { #1 } { 0.5 pt }
10221035
\skip_horizontal:n { -#1 }
1023-
\hbox_to_wd:nn { #1 } { \tex_hss:D #2 \tex_hss:D }
1036+
\hbox_to_wd:nn { #1 } { \@@_hss: #2 \@@_hss: }
10241037
}
10251038
\cs_generate_variant:Nn \@@_box_ulined:nN { nc }
10261039
% \end{macrocode}
@@ -1055,9 +1068,9 @@ To produce the documentation run the original source files ending with
10551068
% \item 内容
10561069
% \end{arguments}
10571070
% \begin{macrocode}
1058-
\cs_new:Npn \@@_get_text_width:Nn #1#2
1071+
\cs_new_protected:Npn \@@_get_text_width:Nn #1#2
10591072
{
1060-
\hbox_set:Nn \l_@@_tmpa_box {#2}
1073+
\hbox_set:Nn \l_@@_tmpa_box { #2 }
10611074
\dim_set:Nn #1 { \box_wd:N \l_@@_tmpa_box }
10621075
}
10631076
% \end{macrocode}
@@ -1066,19 +1079,19 @@ To produce the documentation run the original source files ending with
10661079
% \begin{macro}{\@@_symbol:n}
10671080
% 等价于 \LaTeXe{} 中的 \tn{symbol}。
10681081
% \begin{macrocode}
1069-
\cs_new:Npn \@@_symbol:n #1 { \tex_char:D #1 \scan_stop: }
1082+
\cs_new:Npn \@@_symbol:n #1 { \char_generate:nn { #1 } { 12 } }
10701083
% \end{macrocode}
10711084
% \end{macro}
10721085
%
10731086
% \begin{macro}{\@@_define_name:nn, \@@_define_name:nnn}
10741087
% 用来定义默认名称的辅助函数。
10751088
% \begin{macrocode}
10761089
\cs_new_protected:Npn \@@_define_name:nn #1#2
1077-
{ \tl_const:cn { c_@@_name_ #1 _tl } {#2} }
1090+
{ \tl_const:cn { c_@@_name_ #1 _tl } { #2 } }
10781091
\cs_new_protected:Npn \@@_define_name:nnn #1#2#3
10791092
{
1080-
\tl_const:cn { c_@@_name_ #1 _tl } {#2}
1081-
\tl_const:cn { c_@@_name_ #1 _en_tl } {#3}
1093+
\tl_const:cn { c_@@_name_ #1 _tl } { #2 }
1094+
\tl_const:cn { c_@@_name_ #1 _en_tl } { #3 }
10821095
}
10831096
% \end{macrocode}
10841097
% \end{macro}
@@ -1090,7 +1103,7 @@ To produce the documentation run the original source files ending with
10901103
% \item 产生冲突的宏包
10911104
% \end{arguments}
10921105
% \begin{macrocode}
1093-
\cs_new:Npn \@@_check_pkg_conflict:nn #1#2
1106+
\cs_new_protected:Npn \@@_check_pkg_conflict:nn #1#2
10941107
{
10951108
\hook_gput_code:nnn { package / #1 / after } { . }
10961109
{
@@ -1104,7 +1117,7 @@ To produce the documentation run the original source files ending with
11041117
% \begin{macro}{\@@_clearpage:}
11051118
% 清除页面。
11061119
% \begin{macrocode}
1107-
\cs_new:Npn \@@_clearpage:
1120+
\cs_new_protected:Npn \@@_clearpage:
11081121
{
11091122
\if@openright
11101123
\cleardoublepage
@@ -2139,7 +2152,7 @@ To produce the documentation run the original source files ending with
21392152
% \item 参数列表
21402153
% \end{arguments}
21412154
% \begin{macrocode}
2142-
\cs_new:Npn \@@_define_element:nn #1#2
2155+
\cs_new_protected:Npn \@@_define_element:nn #1#2
21432156
{ \DeclareInstance { sysu } { #1 } { element } { #2 } }
21442157
% \end{macrocode}
21452158
% \end{macro}
@@ -2151,7 +2164,7 @@ To produce the documentation run the original source files ending with
21512164
% \item 实例元素列表
21522165
% \end{arguments}
21532166
% \begin{macrocode}
2154-
\cs_new:Npn \@@_use_element:nn #1#2
2167+
\cs_new_protected:Npn \@@_use_element:nn #1#2
21552168
{
21562169
\clist_map_inline:nn { #2 }
21572170
{ \UseInstance { sysu } { #1 / ##1 } }
@@ -2665,7 +2678,7 @@ To produce the documentation run the original source files ending with
26652678
\skip_horizontal:n { 6 ex } 月
26662679
\skip_horizontal:n { 6 ex } 日
26672680
}
2668-
\tex_hfill:D
2681+
\@@_hfill:
26692682
\parbox { 15 em }
26702683
{
26712684
导师签名: \\ [ 15 pt ]
@@ -2838,7 +2851,7 @@ To produce the documentation run the original source files ending with
28382851
% \begin{macro}{\@@_keywords:nN}
28392852
% 关键词列表前要空一行,使用悬挂缩进。
28402853
% \begin{macrocode}
2841-
\cs_new:Npn \@@_keywords:nN #1#2
2854+
\cs_new_protected:Npn \@@_keywords:nN #1#2
28422855
{
28432856
\para_end: \mode_leave_vertical: \para_end: \noindent
28442857
\@@_get_text_width:Nn \l_@@_tmpa_dim { #1 }
@@ -2854,9 +2867,9 @@ To produce the documentation run the original source files ending with
28542867
% \begin{macro}{\@@_abstract_begin_a:, \@@_abstract_end_a:}
28552868
% 本科生中文摘要。
28562869
% \begin{macrocode}
2857-
\cs_new:Npn \@@_abstract_begin_a:
2870+
\cs_new_protected:Npn \@@_abstract_begin_a:
28582871
{ \@@_chapter:n { \c_@@_name_abstract_tl } }
2859-
\cs_new:Npn \@@_abstract_end_a:
2872+
\cs_new_protected:Npn \@@_abstract_end_a:
28602873
{
28612874
\@@_keywords:nN { \bfseries \c_@@_name_keywords_tl : }
28622875
\g_@@_info_keywords_tl
@@ -2868,13 +2881,13 @@ To produce the documentation run the original source files ending with
28682881
% \begin{macro}{\@@_abstract_en_begin_a:, \@@_abstract_en_end_a:}
28692882
% 本科生英文摘要。
28702883
% \begin{macrocode}
2871-
\cs_new:Npn \@@_abstract_en_begin_a:
2884+
\cs_new_protected:Npn \@@_abstract_en_begin_a:
28722885
{
28732886
\@@_chapter:en
28742887
{ \text_uppercase:n { \c_@@_name_abstract_en_tl } }
28752888
{ \bfseries }
28762889
}
2877-
\cs_new:Npn \@@_abstract_en_end_a:
2890+
\cs_new_protected:Npn \@@_abstract_en_end_a:
28782891
{
28792892
\@@_keywords:nN { \bfseries \c_@@_name_keywords_en_tl :~ }
28802893
\g_@@_info_keywords_en_tl
@@ -2976,12 +2989,12 @@ To produce the documentation run the original source files ending with
29762989
% \begin{macro}{\@@_abstract_begin_b:, \@@_abstract_end_b:}
29772990
% 研究生中文摘要。
29782991
% \begin{macrocode}
2979-
\cs_new:Npn \@@_abstract_begin_b:
2992+
\cs_new_protected:Npn \@@_abstract_begin_b:
29802993
{
29812994
\@@_clearpage:
29822995
\@@_use_element:nn { b / abstract } { title, info, abstract }
29832996
}
2984-
\cs_new:Npn \@@_abstract_end_b:
2997+
\cs_new_protected:Npn \@@_abstract_end_b:
29852998
{
29862999
\@@_keywords:nN { \bfseries \c_@@_name_keywords_tl : }
29873000
\g_@@_info_keywords_tl
@@ -2993,12 +3006,12 @@ To produce the documentation run the original source files ending with
29933006
% \begin{macro}{\@@_abstract_en_begin_b:, \@@_abstract_en_end_b:}
29943007
% 研究生英文摘要。
29953008
% \begin{macrocode}
2996-
\cs_new:Npn \@@_abstract_en_begin_b:
3009+
\cs_new_protected:Npn \@@_abstract_en_begin_b:
29973010
{
29983011
\@@_clearpage:
29993012
\@@_use_element:nn { b / abstract-en } { title, info, abstract }
30003013
}
3001-
\cs_new:Npn \@@_abstract_en_end_b:
3014+
\cs_new_protected:Npn \@@_abstract_en_end_b:
30023015
{
30033016
\@@_keywords:nN { \bfseries \c_@@_name_keywords_en_tl :~ }
30043017
\g_@@_info_keywords_en_tl
@@ -3173,7 +3186,7 @@ To produce the documentation run the original source files ending with
31733186
\cs_gset:Npn \@makefntext #1
31743187
{
31753188
\mode_leave_vertical:
3176-
\hbox_to_wd:nn { 1.5 em } { \@thefnmark \tex_hss:D }
3189+
\hbox_to_wd:nn { 1.5 em } { \@thefnmark \@@_hss: }
31773190
#1
31783191
}
31793192
% \end{macrocode}
@@ -3743,7 +3756,7 @@ To produce the documentation run the original source files ending with
37433756
% \begin{macro}{\@@_tikz_wrapper:Nnnn}
37443757
% 封装 \pkg{tikz} 作图命令。
37453758
% \begin{macrocode}
3746-
\cs_new:Npn \@@_tikz_wrapper:Nnnn #1#2#3#4
3759+
\cs_new_protected:Npn \@@_tikz_wrapper:Nnnn #1#2#3#4
37473760
{
37483761
\begin { tikzpicture }
37493762
[

0 commit comments

Comments
 (0)