用 latex3、tabularray 制作《广东工业大学疫情防控期在校生出入校园申请审批表》

由于疫情,现在离开广州市或出校超过一天的,需提交交纸质申请,而 Word 表格又太麻烦了,因此打算用 latex3 和 tabularray 宏包制作这个表格。

代码:

\documentclass[fontset=none]{ctexart}
\setCJKmainfont{宋体}[AutoFakeBold=true]
\setCJKsansfont{黑体}[AutoFakeBold=true]
\setmainfont{XITS}
\pagestyle{empty}
\usepackage{tabularray}
\usepackage[hmargin=2.54cm, vmargin=1.91cm, a4paper]{geometry}

\ExplSyntaxOn
\cs_generate_variant:Nn \keys_define:nn { nx }
\clist_new:N \l__gdut_info_student_id
\clist_new:N \l__gdut_info_name
\clist_new:N \l__gdut_info_gender
\clist_new:N \l__gdut_info_major_grade
\clist_new:N \l__gdut_info_college
\clist_new:N \l__gdut_info_supervisor
\clist_new:N \l__gdut_info_dormitory
\clist_new:N \l__gdut_info_phone
\clist_new:N \l__gdut_info_period_of_time
\clist_new:N \l__gdut_info_time
\clist_new:N \l__gdut_info_why
\clist_new:N \l__gdut_info_address

\keys_define:nn { gdut } {
student-id .clist_set:N = \l__gdut_info_student_id,
name .clist_set:N = \l__gdut_info_name,
gender .clist_set:N = \l__gdut_info_gender,
major-grade .clist_set:N = \l__gdut_info_major_grade,
college .clist_set:N = \l__gdut_info_college,
supervisor .clist_set:N = \l__gdut_info_supervisor,
dormitory .clist_set:N = \l__gdut_info_dormitory,
phone .clist_set:N = \l__gdut_info_phone,
period-of-time .clist_set:N = \l__gdut_info_period_of_time,
time .clist_set:N = \l__gdut_info_time,
why .clist_set:N = \l__gdut_info_why,
address .clist_set:N = \l__gdut_info_address,
}
\keys_define:nn { gdut }
{
info .meta:nn = { gdut / info } {#1},
}
\NewDocumentCommand \gdutsetup { m }
{ \keys_set:nn { gdut } {#1} }
\DeclareExpandableDocumentCommand \gdutdate { +m }
{
\__gdut_date:www #1 \q_stop
}
\cs_new:Npn \__gdut_date:www #1/#2/#3 \q_stop {
\__gdut_date_aux:nnn {#1} {#2} {#3}
}
\cs_new:Npn \__gdut_date_aux:nnn {
\__gdut_date_aux:Nnnnn \int_to_arabic:n { \l__zhnum_arabic_sep_tl }
}
\cs_new:Npn \__gdut_date_aux:Nnnnn #1 {
\__gdut_date_aux:NNnnnn #1#1
}
\cs_new:Npn \__gdut_date_aux:NNnnnn #1#2#3#4#5#6 {
#1 {#4} #3 \c__zhnum_year_tl #3
#2 {#5} #3 \c__zhnum_month_tl #3
#2 {#6} #3 \c__zhnum_day_tl
}
\cs_generate_variant:Nn \__gdut_date_aux:nnn { V }
\cs_new_protected:Npn \printgdut {
\begingroup\bfseries\sffamily\centering\zihao{3}
广东工业大学疫情防控期在校生出入校园申请审批表\par
\endgroup

\vspace*{\baselineskip}

\centering
\begin{tblr}{
colspec = { |[1.5pt] X[1,c,font=\bfseries] |[1.5pt] X[1,c] | X[3,c] | X[1,c] | X[3,c] |[1.5pt] },
rowspec = { |[1.5pt] Q[m] | Q[m] | Q[m] | Q[m] | Q[m] |[1.5pt] Q[m] Q[m] |[1.5pt] Q[m] Q[m] |[1.5pt] Q[m] Q[m] |[1.5pt] Q[m] Q[m] |[1.5pt] },
rows = {25pt},
cell{1}{1} = {r=5,c=1}{c,m},
cell{4}{3} = {r=1,c=3}{c,m},
cell{6}{2} = {r=1,c=4}{l,h},
cell{6}{1} = {r=2,c=1}{c,m},
cell{7}{2} = {r=1,c=4}{r,f},
cell{8}{1} = {r=2,c=1}{c,m},
cell{8}{2} = {r=1,c=4}{l,h},
cell{9}{2} = {r=1,c=4}{r,f},
cell{10}{1} = {r=2,c=1}{c,m},
cell{10}{2} = {r=1,c=4}{l,h},
cell{11}{2} = {r=1,c=4}{r,f},
cell{12}{1} = {r=2,c=1}{c,m},
cell{12}{2} = {r=1,c=4}{l,h},
cell{13}{2} = {r=1,c=4}{r,f},
}
{学\\\\\\\\\\ 况} & 学号 & \l__gdut_info_student_id & 姓名 & \l__gdut_info_name \\
& 性别 & \l__gdut_info_gender & 专业年级 & \l__gdut_info_major_grade \\
& 所属学院 & \l__gdut_info_college & 导师 & \l__gdut_info_supervisor \\
& 出入时段 & \l__gdut_info_period_of_time \\
& 宿舍 & \l__gdut_info_dormitory & 联系电话 & \l__gdut_info_phone \\
{申\\\\\\\\ 明} & {本人承诺:以下信息真实无误,并按申报路线和时段内往返。\\
本人承诺做好疫情防控措施,单线往返\\
1. 外出详细原因:\l__gdut_info_why\\
2. 外出详细地址:\l__gdut_info_address
}\\
& 申请人(签名):\hspace*{5\ccwd}\exp_args:No\gdutdate{\l__gdut_info_time} \\
{导\\\\\\\\{\small
\normalfont(研究生必填)}} & (导师是否明确对学生监管责任,并同意学生外出学校)\\
& 签名:\hspace*{8\ccwd}年 月 日 \\
{ \\\\\\\\
\\\\  } & \\
& 签名:\hspace*{8\ccwd}年 月 日 \\
{ \\\\\\\\\\  } & (需明确学院是否同意该生离校)\\
& 负责人签名(盖章):\hspace*{8\ccwd}年 月 日 \\
\end{tblr}
}
\ExplSyntaxOff

\gdutsetup{
student-id = {2112101234},
name = {张三},
gender = {男},
major-grade = {21控制专硕},
college = {自动化学院},
supervisor = {李四},
dormitory = {东二123},
phone = {12345678912},
period-of-time = {9月14日上午6点--9月16日下午6点},
time = {2021/9/14},
why = {回家探亲},
address = {广东省广州市番禺区广东工业大学},
}

\begin{document}
\printgdut
\end{document}

用法:在 \gdutsetup 里填信息就好了。

文章作者: sikouhjw
文章链接: https://sikouhjw.github.io/2021/09/14/2021-09-14-application-form/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 sikouhjw.github.io
支付宝捐赠
微信捐赠