Newer
Older
BoldFont=FandolHei-Bold]
\setCJKmonofont{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhsong}{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold]
\setCJKfamilyfont{zhhei}{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhkai}{FandolKai-Regular}[
Extension=.otf,
AutoFakeBold=2.17]
}
%
% \begin{macro}{\@@_load_cjk_font_founder:}
% 调整方正字体括号位置。\footnote{\hologo{XeTeX} 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。}
\sys_if_engine_xetex:T
{ \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } }
\sys_if_engine_luatex:T
{ \defaultCJKfontfeatures { JFM = { zh_CN/{quanjiao,fzpr} } } }
[ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ]
\setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ]
\setCJKmonofont { FZFangSong-Z02 }
\setCJKfamilyfont { zhsong } { FZShuSong-Z01 }
[ BoldFont = FZXiaoBiaoSong-B05 ]
\setCJKfamilyfont { zhhei } { FZHei-B01 }
[AutoFakeBold=2.17]
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
\setCJKmainfont
[
UprightFont = NotoSerifCJKsc-Regular,
BoldFont = NotoSerifCJKsc-Bold,
ItalicFont = NotoSerifCJKsc-Regular,
BoldItalicFont = NotoSerifCJKsc-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Noto~Serif~CJK~SC }
\setCJKsansfont
[
UprightFont = NotoSansCJKsc-Regular,
BoldFont = NotoSansCJKsc-Bold,
ItalicFont = NotoSansCJKsc-Regular,
BoldItalicFont = NotoSansCJKsc-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Noto~Sans~CJK~SC }
\setCJKmonofont { Noto~Sans~Mono~CJK~SC }
\setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC }
\setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC }
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_load_cjk_font_source:}
% \changes{v0.14}{2021/12/20}{增加 Adobe Source Han 作为思源字体。}
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
% Source Han 思源字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_cjk_font_source:
{
\setCJKmainfont
[
UprightFont = SourceHanSerifSC-Regular,
BoldFont = SourceHanSerifSC-Bold,
ItalicFont = SourceHanSerifSC-Regular,
BoldItalicFont = SourceHanSerifSC-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Source~Han~Serif~SC }
\setCJKsansfont
[
UprightFont = SourceHanSansSC-Regular,
BoldFont = SourceHanSansSC-Bold,
ItalicFont = SourceHanSansSC-Regular,
BoldItalicFont = SourceHanSansSC-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Source~Han~Sans~SC }
\setCJKmonofont { FZFangSong-Z02 }
\setCJKfamilyfont { zhsong } { Source~Han~Serif~SC }
\setCJKfamilyfont { zhhei } { Source~Han~Sans~SC }
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
% \subsubsection{定义数学字库}
%
% \begin{macro}{\@@_load_math_font:}
% 设置数学字体 (XITS, 或者 \href{https://www.stixfonts.org}{STIX}, 与 Times New Roman 最为相近)
% 通用数学字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_math_font:
{
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
BoldFont = XITSMath-Bold,
Extension = .otf]
\setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}]
\setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}]
}
% \end{macrocode}
% \end{macro}
%
%
\use:c { @@_load_latin_font_ \g_@@_latin_font_tl : }
\use:c { @@_load_cjk_font_ \g_@@_cjk_font_tl : }
% \changes{v0.10}{2021/09/28}{修正了数学字体。}
% \begin{macrocode}
\NewDocumentCommand \songti { } { \CJKfamily { zhsong } }
\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } }
\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } }
\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } }
% \end{macrocode}
% 重定义字号命令。
% \begin{macrocode}
\RenewDocumentCommand \large { } { \zihao { 4 } }
% 载入设置的字体。此处设置与文档类一同载入,否则在导言区后载入字体可能导致一部分覆盖字体的命令失效。
% \BeforeBeginEnvironment { document } { \@@_load_font: }
\@@_load_font:
% 草稿模式下显示页面文字范围边界以及页眉、页脚线。
% \begin{macrocode}
\bool_if:NT \g_@@_draft_bool { \geometry { showframe } }
% \end{macrocode}
%
% \begin{macro}{\@@_fancy_head:nn}
% 页眉样式,设置为小号字体、楷书。这里对 \pkg{fancyhdr} 的命令进行了包装。
% \begin{macrocode}
\cs_new_protected:Npn \@@_fancy_head:nn #1#2
{ \fancyhead [#1] { \small \kaishu \nouppercase {#2} } }
% \end{macrocode}
% \end{macro}
%
% 重定义 \pkg{fancyhdr} 的 \opt{plain} 样式,即本科生正文和部分特殊页面使用的的
% 页眉页脚样式。页眉无内容;页脚为居中的页码,使用五号新罗马体数字。注意标记页眉
% 页脚横线宽度的变量并不是 |dim| 类型的,但是采取了该类型的格式。
\fancyfoot [ C ] { \zihao { 5 } \rmfamily \thepage }
\tl_set:Nn \headrulewidth { \c_zero_dim }
\tl_set:Nn \footrulewidth { \c_zero_dim }
% \changes{v0.15}{2022/01/17}{修复单页模式的页眉问题。}
% 以 \opt{plain} 样式为基础,单独设置研究生模板的页眉内容。在 \cs{fancyhead} 的
% 可选参数中,\opt{E} 和 \opt{O} 分别表示在偶数页(even)和奇数页(odd), 而
% \opt{L}、\opt{R} 和 \opt{C} 则分别表示左(left)、右(right)和中间(center)
% 。按照通常的排版规则,在双面模式下,偶数页的中间页眉文字在左,奇数页则在右。
% 单面模式下,左右页眉都要显示。
\@@_fancy_head:nn { EL } { \leftmark }
\@@_fancy_head:nn { OR } { \rightmark }
\@@_fancy_head:nn { L } { \leftmark }
\@@_fancy_head:nn { R } { \rightmark }
\tl_set:Nn \headrulewidth { 0.4 pt }
\dim_set:Nn \headheight { 20 pt }
% \begin{macro}{\frontmatter}
% 重定义 \cs{frontmatter},清空页眉页脚以及页码设置。
% \changes{v0.12}{2021/12/03}{修复了摘要页字体格式泄漏到正文的问题。}
% \changes{v0.12}{2021/12/03}{修复了页眉上长标题重叠的问题。}
% 重定义 \cs{mainmatter},在论文主体部分载入页眉页脚设置,使用阿拉伯数字重新进行
% 页码编号。
% \begin{macrocode}
\RenewDocumentCommand \mainmatter { }
{
\cleardoublepage
\pagestyle { plain }
\int_compare:nF { \l_@@_info_degree_int == 1 }
{ \@@_set_heading_g: }
\tl_const:Nn \c_@@_sec_format_tl { \large \normalfont \sffamily }
\addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1 }
}
\cs_generate_variant:Nn \@@_chapter:n { V }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_chapter_no_toc:n,\@@_chapter_no_toc:V}
% 目录自身不出现在目录中,需特别处理。参考
% \url{https://tex.stackexchange.com/a/1821}。
% \begin{macrocode}
\cs_new_protected:Npn \@@_chapter_no_toc:n #1
{
\chapter * { #1 }
\@@_chapter_header:n { #1 }
\pdfbookmark [ 0 ] { #1 } { toc }
}
\cs_generate_variant:Nn \@@_chapter_no_toc:n { V }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_chapter_header:n}
% 单页模式下,目录、摘要、符号表等特殊页面的页眉中间为相应标题,左右为空。这里通
% 过居中的 \tn{leftmark} 实现。
% \begin{macrocode}
\cs_new_protected:Npn \@@_chapter_header:n #1
{
\bool_if:NTF \g_@@_twoside_bool
{ \markboth { #1 } { #1 } }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\njuchapter}
% \begin{macrocode}
\NewDocumentCommand \njuchapter { m } { \@@_chapter:V { #1 } }
chapter / beforeskip = 10 pt,
chapter / afterskip = 60 pt,
chapter / format = \c_@@_sec_format_tl \centering,
section / format = \c_@@_sec_format_tl,
subsection / format = \c_@@_sec_format_tl,
subsubsection / format = \c_@@_sec_format_tl,
% \changes{v0.13}{2021/12/09}{移除 \pkg{tocloft},用 \pkg{ctex} 修改目录样式。}
chapter / tocline = \c_@@_sec_format_tl \CTEXnumberline { #1 } #2
{
\group_begin:
\keys_set:nn { ctex } { chapter/format = \centering \zihao { 3 } \bf }
% \begin{macro}{\tableofcontents,\listoffigures,\listoftables}
% 重定义目录命令,修改标题格式并插入书签。
\RenewDocumentCommand \tableofcontents { }
{ \@@_modify_toc_title:nn { \contentsname } { toc } }
\RenewDocumentCommand \listoffigures { }
{ \@@_modify_toc_title:nn { \listfigurename } { lof } }
\RenewDocumentCommand \listoftables { }
{ \@@_modify_toc_title:nn { \listtablename } { lot } }
\keys_define:nn { nju / bib }
{
% \end{macrocode}
% \begin{macro}{bib/style}
% 参考文献样式。分为顺序编码制 \opt{numeric}(\opt{gb7714-2015} 样式)和著者-
% 出版年制 \opt{author-year}(\opt{gb7714-2015ay} 样式)。用户选取的样式会被加入
% 选项列表中,以待传进 \pkg{biblatex} 宏包。
% \begin{macrocode}
style .choice:,
style / numeric .code:n =
{ \clist_set:Nn \l_@@_tmp_clist { style = gb7714-2015 } },
style / author-year .code:n =
{ \clist_set:Nn \l_@@_tmp_clist { style = gb7714-2015ay } },
style .initial:n = numeric,
% \end{macrocode}
% \end{macro}
% \begin{macro}{bib/resource}
% 参考文献数据源。
% \begin{macrocode}
resource .clist_set:N = \l_@@_bib_resource_clist
% \end{macro}
%
% \begin{macro}{\addbibresource}
% 为了吸收用户在导言区设置的选项,\pkg{biblatex} 宏包被设置在导言区末尾才会载
% 入。此处单独定义了可以在导言区使用的 \cs{addbibresource} 命令,用于兼容传统的
% 添加参考文献数据源的方法。
% \begin{macrocode}
\NewDocumentCommand \addbibresource { m }
% 载入 \pkg{biblatex} 宏包前,必须禁用自行定义的 \cs{addbibresource} 命令,并传入用户设置的选项。
% \begin{macrocode}
\cs_new_protected:Npn \@@_biblatex_pre_setup:
{
\clist_put_right:Nn \l_@@_tmp_clist { backend = biber }
\exp_args:NV \PassOptionsToPackage \l_@@_tmp_clist { biblatex }
% \begin{macrocode}
\cs_new_protected:Npn \@@_biblatex_post_setup:
{
% \end{macrocode}
% \changes{v0.12}{2021/12/06}{设置输出参考文献的默认选项。}
% 修改参考文献的头部样式,自动添加目录条目。
\defbibheading { njubib } [ \bibname ] { \@@_chapter:V { ##1 } }
\DeclarePrintbibliographyDefaults { heading = njubib }
% \end{macrocode}
\clist_map_inline:Nn \l_@@_bib_resource_clist
{ \addbibresource { ##1 } }
\AtEveryBibitem
{
\clist_map_inline:nn
{ abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint }
{ \clearfield { ##1 } }
% \ifentrytype{online} { }
% {
% \ifentrytype{misc} { }
% \clearfield{urldate} { \clearfield{url} }
% }
% 使用 \pkg{etoolbox} 提供的 \tn{BeforeBeginEnvironment},在 \env{document} 环境
% 开始的钩子前载入 \pkg{biblatex} 并进行相关设置。
%\hook_gset_rule:nnnn { begindocument/before } { . } { < } { xeCJK }
%\hook_gput_code:nnn { env/document/begin } { . }
\BeforeBeginEnvironment { document }
\pdfstringdefDisableCommands
{ \cs_set_eq:NN \\ \prg_do_nothing: }
\hypersetup
{
bookmarksnumbered = true,
psdextra = true,
unicode = true,
% \end{macrocode}
% 填写 PDF 元信息。
% \begin{macrocode}
pdfauthor = \l_@@_info_author_tl,
pdfkeywords = \l_@@_info_keywords_clist,
pdfcreator = \c_@@_name_pdf_creator_tl
}
}
% 用于修改 \pkg{cleverref} 的标签名称的辅助函数。
% \begin{macrocode}
\cs_new_protected:Npn \@@_cref_name:n #1
{
\clist_map_inline:nn { #1 }
\crefname { ##1 }
{ \@@_name:n { ##1 } } { \@@_name:n { ##1 _en } }
}
\crefformat { equation } { 公式~#2#1#3~ }
\crefformat { chapter } { 第#2#1#3章 }
\crefformat { section } { 第~#2#1#3~节 }
\crefformat { subsection } { 第~#2#1#3~小节 }
\crefformat { subsubsection } { 第~#2#1#3~小节 }
% \end{macrocode}
%
% 修改 \pkg{cleverref} 的标签名称。
% \begin{macrocode}
\@@_cref_name:n { figure, table, appendix, proof }
%
% 设置默认图片扩展名,允许在不键入扩展名时自动进行补全。
% \begin{macrocode}
% \changes{v0.12}{2021/12/06}{删除了可能导致冲突的 \pkg{floatrow}。}
\DeclareCaptionStyle{njucap}
{
font = small,
labelfont = bf,
labelsep = quad,
justification = centering
}
\captionsetup [ figure ] { style = njucap }
\captionsetup [ table ] { style = njucap }
% \changes{v0.12}{2021/12/07}{删除了 \pkg{enumitem} 的部分列表环境设置。}
% \begin{macro}{\@@_new_theorem:N}
% 用于定义普通定理环境的辅助函数。
% \begin{arguments}
% \item 定理名称列表,|clist| 型变量
% \end{arguments}
% 除证明以外的环境都不需要证毕符号,在此清空其设置。
% \begin{macrocode}
\cs_new_protected:Npn \@@_new_theorem:N #1
\theoremsymbol { }
\clist_map_inline:Nn #1
{ \newtheorem { ##1 } { \@@_name:n { ##1 } } }
}
% \end{macrocode}
% \end{macro}
%
% 定义证明环境。证毕符号使用 \tn{mdlgwhtsquare} 绘制,对应于 |U+25A1| 字符
% \footnote{\url{https://tex.stackexchange.com/questions/567135/how-get-box-like-symbol-with-xelatex}}。
% \begin{macrocode}
\theoremsymbol { \ensuremath { \mdwhtsquare } }
\newtheorem* { proof } { \c_@@_name_proof_tl }
% \end{macrocode}
%
% 定义普通定理环境。
% \end{macrocode}
% 从 |\\| 进行分割,存入 |clist|。
% \begin{macrocode}
\seq_set_split:NnV \l_@@_tmp_seq { \\ } { #1 }
\clist_set_from_seq:NN \l_@@_tmp_clist \l_@@_tmp_seq
% \begin{macrocode}
\@@_put_inempty_seg:nnn { #1 } { 1 } { 15 }
\@@_put_inempty_seg:nnn { #1 } { 16 } { 15 }
\@@_put_inempty_seg:nnn { #1 } { 31 } { 15 }
% \begin{macro}{\@@_multiline_title:nnn}
% 生成多行标题。
% \begin{arguments}
% \item 内容格式
% \item 名称盒子宽度,|dim| 型变量
% \item 内容盒子宽度,|dim| 型变量
% \end{arguments}
\@@_spread_box:nnn { #2 } { \kaishu } { \c_@@_name_title_tl }
\@@_hskip:
% \item 名称盒子宽度,|dim| 型变量
% \item 内容盒子宽度,|dim| 型变量
% \end{arguments}
\@@_spread_box:nnn { #2 } { \kaishu } { \@@_name:n { #1 } }
% \item 名称盒子宽度,|dim| 型变量
% \item 内容盒子宽度,|dim| 型变量
% \end{arguments}
\@@_spread_box:nnn { #3 } { \kaishu } { \@@_name:n { #1 } }
\@@_spread_box:nnn { #3 } { \kaishu } { \@@_name:n { #2 } }
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
% \begin{macro}{\@@_cover_supv_entry:nnn}
% 生成两项导师信息条目,仅用于本科生封面。
% \begin{arguments}
% \item 条目名称
% \item 长内容盒子宽度,|dim| 型变量
% \item 短内容盒子宽度,|dim| 型变量
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_cover_supv_entry:nnn #1#2#3
{
\@@_spread_box:nnn { #2 } { \kaishu } { \@@_name:n { #1 } }
\@@_hskip:
\@@_ulined_center_box:nn { #3 }
{ \clist_item:cn { l_@@_info_ #1 _clist } { 1 } }
\skip_horizontal:n { 0.5 em }
\@@_spread_box:nnn { #2 } { \kaishu } { \c_@@_name_supv_ttl_tl }
\@@_hskip:
\@@_ulined_center_box:nn { #3 }
{ \clist_item:cn { l_@@_info_ #1 _clist } { 2 } }
\@@_vskip:
}
% \end{macrocode}
% \end{macro}
%
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
% \subsubsection{定义对象}
% \changes{v0.15}{2022/01/24}{使用 \pkg{xtemplate} 重构封面。}
%
% 本模板使用 \pkg{xtemplate} 提供的面向对象方法简化封面和摘要的绘制过程。
%
% 当我们把页面部件而不是整个页面考虑为一个对象时,它天然地只具备有限数量的属性:上下边距、对齐方式、字形字号、文字内容等,使得 Template 的定义也是有限的。而具体的页面是这些对象的实例的集合,创建页面只需传入一个列表调用各个 Instance 即可。这种做法能极大优化代码的可读性。
%
% \begin{variable}{\l__mytest_content_tl,\l__mytest_format_tl,
% \l__mytest_begin_align_tl,\l__mytest_end_align_tl,\l__mytest_top_skip}
% 用于描述页面元素特征的临时变量。
% \begin{macrocode}
\tl_new:N \l__mytest_content_tl
\tl_new:N \l__mytest_format_tl
\tl_new:N \l__mytest_begin_align_tl
\tl_new:N \l__mytest_end_align_tl
\skip_new:N \l__mytest_top_skip
% \end{macrocode}
% \end{variable}
%
% 声明对象类型。
% \begin{macrocode}
\DeclareObjectType { nju } { \c_zero_int }
% \end{macrocode}
%
% 声明页面元素模板接口。
% \begin{macrocode}
\DeclareTemplateInterface { nju } { page-element } { \c_zero_int }
{
content : tokenlist = \c_empty_tl,
format : tokenlist = \c_empty_tl,
top-skip : skip = \c_zero_skip,
align : choice { l, r, c, n } = c
}
% \end{macrocode}
%
% 声明页面元素模板代码。
% \begin{macrocode}
\DeclareTemplateCode { nju } { page-element } { \c_zero_int }
{
content = \l__mytest_content_tl,
format = \l__mytest_format_tl,
top-skip = \l__mytest_top_skip,
align =
{
l =
{ \tl_set_eq:NN \l__mytest_begin_align_tl \flushleft
\tl_set_eq:NN \l__mytest_end_align_tl \endflushleft },
r =
{ \tl_set_eq:NN \l__mytest_begin_align_tl \flushright
\tl_set_eq:NN \l__mytest_end_align_tl \endflushright },
c =
{ \tl_set_eq:NN \l__mytest_begin_align_tl \center
\tl_set_eq:NN \l__mytest_end_align_tl \endcenter },
n =
{ \tl_clear:N \l__mytest_begin_align_tl
\tl_clear:N \l__mytest_end_align_tl }
}
}
{
\AssignTemplateKeys
\vspace* { \l__mytest_top_skip - 0.5 cm }
\group_begin:
\l__mytest_begin_align_tl
\l__mytest_format_tl
\l__mytest_content_tl
\l__mytest_end_align_tl
\group_end:
}
% \end{macrocode}
%
% \begin{macro}{\@@_declare_instance:nn}
% 封装 \pkg{xtemplate} 的函数,简化定义实例的过程。
% \begin{arguments}
% \item 实例名称
% \item 参数列表
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_declare_instance:nn #1#2
{ \DeclareInstance { nju } {#1} { page-element } {#2} }
% \end{macrocode}
% \end{macro}
%
%
% \begin{macrocode}
\keys_define:nn { nju / style }
{
% \end{macrocode}
% \begin{macro}{style/emblem-img}
% \changes{v0.14}{2021/12/23}{提供选择外置校徽图片的接口。}
% 校徽图片路径。
% \begin{macrocode}
emblem-img .tl_set:N = \l_@@_emblem_img_tl,
% \end{macrocode}
% \end{macro}
% \begin{macro}{style/name-img}
% \changes{v0.14}{2021/12/23}{提供选择外置校名图片的接口。}
% 校名图片路径。
% \begin{macrocode}
name-img .tl_set:N = \l_@@_name_img_tl
}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\ctex_at_end_preamble:n
{
% \end{macrocode}
% \begin{macro}{\njuemblem,\njuname}
% 如果用户在定义了图片的路径,则覆盖 \pkg{njuvisual} 提供的绘制命令。
% \begin{macrocode}
\tl_if_empty:NF \l_@@_emblem_img_tl
{
\RenewDocumentCommand \njuemblem { o m m }
{ \includegraphics [ width = #2, height = #3 ]
{ \l_@@_emblem_img_tl } }
}
\tl_if_empty:NF \l_@@_name_img_tl
{
\RenewDocumentCommand \njuname { o m m }
{ \includegraphics [ width = #2, height = #3 ]
{ \l_@@_name_img_tl } }
}
% \paragraph{本科生}
%
% \begin{macro}{cover/ug/emblem-img,cover/ug/name-img}
% 本科生封面校名、校徽图片实例。
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
\@@_declare_instance:nn { cover / ug / emblem-img }
{
content = \njuemblem [ black ] { ! } { 3.35 cm },
align = l
}
\@@_declare_instance:nn { cover / ug / name-img }
{ content = \njuname [ black ] { ! } { 3 cm } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/ug/title}
% 本科生封面标题实例。
% \begin{macrocode}
\@@_declare_instance:nn { cover / ug / title }
{
content =
\@@_spread_box:nnn { 9 em } { \bf } { \l_@@_info_type_tl },
format = \zihao { -1 },
top-skip = -1 cm
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/ug/info}
% 本科生封面信息栏实例。
% \begin{macrocode}
\@@_declare_instance:nn { cover / ug / info }
{
content =
\@@_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em },
format = \zihao { 3 },
top-skip = 1 cm
}
% \begin{macro}{\@@_cover_info_ug:nnn}
% 本科生封面信息栏。
% \item 名称盒子宽度,|dim| 型变量
% \item 长内容盒子宽度,|dim| 型变量
% \item 短内容盒子宽度,|dim| 型变量
\@@_cover_entry:nnn { dept } { #1 } { #2 }
\@@_cover_entry:nnn { major } { #1 } { #2 }
\@@_multiline_title:nnn { \bf } { #1 } { #2 }
\@@_cover_entry:nnn { author } { #1 } { #2 }
\@@_cover_supv_entry:nnn { supv } { #1 } { #3 }
\bool_if:NT \l_@@_second_supv_bool
{ \@@_cover_supv_entry:nnn { supv_ii } { #1 } { #3 } }
\@@_cover_entry:nnn { sm_date } { #1 } { #2 }
\vfill
}
% \end{macrocode}
% \end{macro}
%
% \paragraph{研究生}
%
% \subparagraph{正面} 包括校名、校徽、标题、信息栏。
%
% \begin{macro}{cover/g/emblem-img,cover/g/name-img}
% 研究生封面校名、校徽图片实例。
% \begin{macrocode}
\@@_declare_instance:nn { cover / g / emblem-img }
{
content = \njuemblem [ black ] { ! } { 1.9 cm },
top-skip =1 cm
\@@_declare_instance:nn { cover / g / name-img }
{ content = \njuname [ black ] { 4.4 cm } { ! } }
% \begin{macro}{cover/g/title}
% 研究生封面标题实例。
\@@_declare_instance:nn { cover / g / title }
content =
\@@_spread_box:nnn { 9 em } { } { \l_@@_info_type_tl }
\skip_vertical:n { -0.5 cm }
\c_@@_name_apply_tl,
format = \zihao { -1 } \bf \kaishu,
top-skip = -0.5 cm
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/info}
% 研究封面信息栏实例。
% \begin{macrocode}
\@@_declare_instance:nn { cover / g / info }
{
content = \@@_cover_info_g:nn { 6.2 em } { 18 em },
format = \zihao { 3 } \kaishu,
top-skip = 3 cm
% \begin{macro}{\@@_cover_info_g:nn}
% 研究生封面信息栏。
% \begin{arguments}
% \item 名称盒子宽度,|dim| 型变量
% \item 内容盒子宽度,|dim| 型变量
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_cover_info_g:nn #1#2
\begin{minipage} [ c ] { #1 + #2 + 0.3 em }
\raggedleft
\skip_vertical:n { 2 cm } \l_@@_info_sm_date_tl
\vfill
}
% \end{macrocode}
% \end{macro}
%
% \subparagraph{背面}
%
% \begin{macro}{cover/g/back}
% 研究生封面背面信息实例。
% \begin{macrocode}
\@@_declare_instance:nn { cover / g / back }
{
content = \@@_cover_back_g:,
format = \zihao { 3 } \kaishu,
top-skip = 18 cm,
align = l
% \begin{macrocode}
\cs_new_protected:Npn \@@_cover_back_g:
\@@_spread_box:nnn { 6.2 em } { \kaishu } { \c_@@_name_id_tl }
{ : \@@_quad: } \l_@@_info_id_tl
\@@_vskip: