Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NJUThesis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wendi Zheng
NJUThesis
Commits
77c69ce8
Commit
77c69ce8
authored
3 years ago
by
Yu Xiong
Browse files
Options
Downloads
Patches
Plain Diff
refactor: 简化字体变量名称
parent
4226d586
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/njuthesis-sample.tex
+2
-2
2 additions, 2 deletions
docs/njuthesis-sample.tex
source/njuthesis.dtx
+47
-45
47 additions, 45 deletions
source/njuthesis.dtx
with
49 additions
and
47 deletions
docs/njuthesis-sample.tex
+
2
−
2
View file @
77c69ce8
...
...
@@ -32,8 +32,8 @@
% type = thesis|design, % 文档类型,默认为毕业论文
% nlcover = true|false, % 是否需要国家图书馆封面,默认关闭
% 以下两项为字体设置,不改动则自动调用系统预装字体
%
custom
latinfont=win
dows
|mac
os
|linux|gyre|none,
% c
ustomchinese
font=win
dows
|mac
os
|linux|fandol|founder|noto|none,
% latin
-
font=win|mac|linux|gyre|none,
% c
jk-
font=win|mac|linux|fandol|founder|noto|none,
]
{
njuthesis
}
\njusetup
{
...
...
This diff is collapsed.
Click to expand it.
source/njuthesis.dtx
+
47
−
45
View file @
77c69ce8
...
...
@@ -197,7 +197,7 @@ through XeTeX.
% \changes{v0.12}{2021/11/29}{更新了说明文档封面设计。}
% \changes{v0.12}{2021/11/30}{区分测试文件和空白模板。}
% \changes{v0.12}{2021/12/06}{修改了说明文档的代码呈现样式。}
% \changes{v0.13}{2021/12/12}{
显著提升
编译速度。}
% \changes{v0.13}{2021/12/12}{
优化了
编译速度。}
%
% \maketitle
%
...
...
@@ -599,10 +599,10 @@ through XeTeX.
%
% 如果希望更改本模板使用的字体,请填写以下两个选项以覆盖操作系统检测得到的设置。
%
% \begin{function}[added=2021-09-07
]{customchinesefont,custom
latinfont}
% \begin{function}[added=2021-09-07
,updated=2021-12-12]{cjk-font,
latin
-
font}
% \begin{syntax}
% c
ustomchinese
font = <(win
dows
)|mac
os
|fandol|founder|noto|none>
%
custom
latinfont = <(win
dows
)|mac
os
|gyre|none>
% c
jk-
font = <(win)|mac|fandol|founder|noto|none>
% latin
-
font = <(win)|mac|gyre|none>
% \end{syntax}
% 手动指定字体。
% \end{function}
...
...
@@ -1377,18 +1377,18 @@ through XeTeX.
% \end{macrocode}
% \end{variable}
%
% \begin{variable}{\g_@@_load_sys
tem
_font
set
_bool}
% \begin{variable}{\g_@@_load_sys_font_bool}
% 定义用于判断是否需要载入系统预装字体的变量。
% \begin{macrocode}
\bool_new:N \g_@@_load_sys
tem
_font
set
_bool
\bool_new:N \g_@@_load_sys_font_bool
% \end{macrocode}
% \end{variable}
%
% \begin{variable}{\g_@@_latin_font
set
_tl,\g_@@_cjk_font
set
_tl}
% \begin{variable}{\g_@@_latin_font_tl,\g_@@_cjk_font_tl}
% 用于存储所使用字体名称的全局变量
% \begin{macrocode}
\tl_new:N \g_@@_latin_font
set
_tl
\tl_new:N \g_@@_cjk_font
set
_tl
\tl_new:N \g_@@_latin_font_tl
\tl_new:N \g_@@_cjk_font_tl
% \end{macrocode}
% \end{variable}
%
...
...
@@ -1619,7 +1619,7 @@ through XeTeX.
% \begin{macro}{degree}
% 学位类型。
% \begin{macrocode}
degree
.choices:nn = { ug, mg, mf, phd }
degree .choices:nn = { ug, mg, mf, phd }
{ \int_set_eq:NN \g_@@_info_degree_int \l_keys_choice_int
\tl_set:Nn \l_@@_info_degree_tl
{ \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int } }
...
...
@@ -1629,20 +1629,20 @@ through XeTeX.
\int_compare:nTF { \g_@@_info_degree_int == 1 }
{ \tl_set:Nn \g_@@_info_diploma_tl { ug } }
{ \tl_set:Nn \g_@@_info_diploma_tl { g } } },
degree
.initial:n = ug,
degree .initial:n = ug,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{type}
% 论文类型。\cs{l_keys_choice_int} 需要被展开以获取正确的序号。
% \begin{macrocode}
type
.choices:nn = { thesis, design }
type .choices:nn = { thesis, design }
{ \int_set_eq:NN \l_@@_info_type_int \l_keys_choice_int
\tl_set:Nn \l_@@_info_type_tl
{ \clist_item:Nn \c_@@_name_type_clist { \l_@@_info_type_int } }
\tl_put_left:Nn \l_@@_info_type_tl
{ \tl_use:c { c_@@_name_ \g_@@_info_diploma_tl _tl } } },
type
.initial:n = thesis,
type .initial:n = thesis,
% \end{macrocode}
% \end{macro}
%
...
...
@@ -1654,15 +1654,16 @@ through XeTeX.
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{customlatinfont,customchinesefont}
% \begin{macro}{latin-font,cjk-font}
% \changes{v0.13}{2021/12/12}{简化字体选项名称。}
% 定义字体选项
% \begin{macrocode}
custom
latinfont
.choices:nn =
{ gyre, mac
os
, win
dows
, none }
{ \tl_set_eq:NN \g_@@_latin_font
set
_tl \l_keys_choice_tl },
c
ustomchinese
font .choices:nn =
{ fandol, founder, mac
os
, noto, win
dows
, none }
{ \tl_set_eq:NN \g_@@_cjk_font
set
_tl \l_keys_choice_tl },
latin
-
font .choices:nn =
{ gyre, mac, win, none }
{ \tl_set_eq:NN \g_@@_latin_font_tl \l_keys_choice_tl },
c
jk-
font
.choices:nn =
{ fandol, founder, mac, noto, win, none }
{ \tl_set_eq:NN \g_@@_cjk_font_tl \l_keys_choice_tl },
}
% \end{macrocode}
% \end{macro}
...
...
@@ -2050,7 +2051,7 @@ through XeTeX.
% \begin{macrocode}
\sys_if_engine_luatex:T
{
\RequirePackage{lua-ul
,dashundergaps
}
\RequirePackage{lua-ul}
\NewDocumentCommand \njuline { m } { \underLine{#1} \null }
}
% \end{macrocode}
...
...
@@ -2091,11 +2092,11 @@ through XeTeX.
% 判断用户是否自定义了中英文字体。如果其中任意一种未被定义,
% 则使用系统预装字体覆盖字体选项。
% \begin{macrocode}
\tl_if_empty:NTF \g_@@_latin_font
set
_tl
{ \bool_gset_true:N \g_@@_load_sys
tem
_font
set
_bool }
\tl_if_empty:NTF \g_@@_latin_font_tl
{ \bool_gset_true:N \g_@@_load_sys_font_bool }
{
\tl_if_empty:NT \g_@@_cjk_font
set
_tl
{ \bool_gset_true:N \g_@@_load_sys
tem
_font
set
_bool }
\tl_if_empty:NT \g_@@_cjk_font_tl
{ \bool_gset_true:N \g_@@_load_sys_font_bool }
}
% \end{macrocode}
%
...
...
@@ -2104,16 +2105,16 @@ through XeTeX.
% 检测 macOS 的命令由\pkg{ctex}提供,
% 这两种情况外的系统被判断为 Linux,一律使用自由字体。
% \begin{macrocode}
\bool_if:NT \g_@@_load_sys
tem
_font
set
_bool
\bool_if:NT \g_@@_load_sys_font_bool
{
\sys_if_platform_windows:TF
{ \tl_set:Nn \g_@@_latin_font
set
_tl { win
dows
}
\tl_set:Nn \g_@@_cjk_font
set
_tl { win
dows
} }
{ \tl_set:Nn \g_@@_latin_font_tl { win
}
\tl_set:Nn \g_@@_cjk_font_tl { win
} }
{ \ctex_if_platform_macos:TF
{ \tl_set:Nn \g_@@_latin_font
set
_tl { mac
os
}
\tl_set:Nn \g_@@_cjk_font
set
_tl { mac
os
} }
{ \tl_set:Nn \g_@@_latin_font
set
_tl { gyre
}
\tl_set:Nn \g_@@_cjk_font
set
_tl { fandol
} } }
{ \tl_set:Nn \g_@@_latin_font_tl { mac
}
\tl_set:Nn \g_@@_cjk_font_tl { mac
} }
{ \tl_set:Nn \g_@@_latin_font_tl { gyre }
\tl_set:Nn \g_@@_cjk_font_tl { fandol } } }
}
% \end{macrocode}
%
...
...
@@ -2122,10 +2123,10 @@ through XeTeX.
%
% 接下来逐个定义所需要使用的字库。
%
% \begin{macro}{\@@_load_latin_font_win
dows
:}
% \begin{macro}{\@@_load_latin_font_win:}
% Windows 西文字体
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_latin_font_win
dows
:
\cs_new_protected:Npn \@@_load_latin_font_win:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
...
...
@@ -2134,10 +2135,10 @@ through XeTeX.
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_load_latin_font_mac
os
:}
% \begin{macro}{\@@_load_latin_font_mac:}
% macOS 西文字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_latin_font_mac
os
:
\cs_new_protected:Npn \@@_load_latin_font_mac:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
...
...
@@ -2177,10 +2178,10 @@ through XeTeX.
%
% \subsubsection{定义中文字库}
%
% \begin{macro}{\@@_load_cjk_font_win
dows
:}
% \begin{macro}{\@@_load_cjk_font_win:}
% Windows 中文字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_cjk_font_win
dows
:
\cs_new_protected:Npn \@@_load_cjk_font_win:
{
\setCJKmainfont{SimSun}[
AutoFakeBold=2.17,
...
...
@@ -2196,11 +2197,11 @@ through XeTeX.
% \end{macro}
%
%
% \begin{macro}{\@@_load_cjk_font_mac
os
:}
% \begin{macro}{\@@_load_cjk_font_mac:}
% macOS 字体。
% TODO: 修复 macOS 字体支持,实现开箱即用。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_cjk_font_mac
os
:
\cs_new_protected:Npn \@@_load_cjk_font_mac:
{
% 移除 does not contain script "CJK" 警告
\msg_redirect_name:nnn {fontspec} {no-script} {info}
...
...
@@ -2327,8 +2328,8 @@ through XeTeX.
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_font:
{
\use:c { @@_load_latin_font_ \g_@@_latin_font
set
_tl : }
\use:c { @@_load_cjk_font_ \g_@@_cjk_font
set
_tl : }
\use:c { @@_load_latin_font_ \g_@@_latin_font_tl : }
\use:c { @@_load_cjk_font_ \g_@@_cjk_font_tl : }
% \end{macrocode}
% 自行定义C\hologo{TeX}中的四类字体命令。
% \begin{macrocode}
...
...
@@ -3115,8 +3116,8 @@ through XeTeX.
\c_@@_orig_decl_text_tl
\vfil
\begin{flushright}
{ \c_
@@_name
_
orig_sign
_tl
} \@@_uline:n { 7 em } \@@_vskip:
{ \c_
@@_name
_
orig_date
_tl
} \@@_uline:n { 7 em }
\
@@_name
:n {
orig_sign } \@@_uline:n { 7 em } \@@_vskip:
\
@@_name
:n {
orig_date } \@@_uline:n { 7 em }
\end{flushright}
\vfil
}
...
...
@@ -3310,7 +3311,8 @@ through XeTeX.
% \begin{macrocode}
{
\@@_full_uline:NV \l_@@_tmp_dim
{ \clist_item:cn { c_@@_name_type #1 _clist } { \l_@@_info_type_int } # 2 }
{ \clist_item:cn { c_@@_name_type #1 _clist }
{ \l_@@_info_type_int } # 2 }
\@@_ulined_center_box:nn { \l_@@_tmp_dim }
{ \tl_range:Nnn \l_@@_info_title_en_tl { 1 } { 40 } } \\
\@@_uline:n { \textwidth } \@@_qquad:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment