summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-18 22:42:06 +0000
committerKarl Berry <karl@freefriends.org>2022-04-18 22:42:06 +0000
commitf37f08c5256e11958ef809fde4217cf30dc345bf (patch)
tree8d9a0d418545c7c94a92738e8323aefbfa720983 /Master/texmf-dist/tex/xelatex
parentd754ac89eb6de484f6001ffbabf909094a639937 (diff)
xduts (19apr22)
git-svn-id: svn://tug.org/texlive/trunk@63075 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r--Master/texmf-dist/tex/xelatex/xduts/xdufont.sty152
-rw-r--r--Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls370
2 files changed, 412 insertions, 110 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty
index a1916f28425..bb245bf9f6f 100644
--- a/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty
+++ b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty
@@ -6,34 +6,36 @@
%%
%% xduts.dtx (with options: `sty,xdufont')
%%
-%% Copyright (C) 2022--2022 by @note286 in GitHub
-%% ---------------------------------------------------------------------
+%% Copyright 2022--2022 by @note286 in GitHub and CTAN
%%
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either
-%% version 1.3c of this license or (at your option) any later
-%% version. This version of this license is in
-%% http://www.latex-project.org/lppl/lppl-1-3c.txt
-%% and the latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of
-%% LaTeX version 2005/12/01 or later.
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
%%
-%% This work has the LPPL maintenance status "maintained".
+%% This work has the LPPL maintenance status `author-maintained'.
%%
-%% ---------------------------------------------------------------------
+%% The Current Maintainer of this work is @note286 in GitHub and CTAN.
+%%
+%% This work consists of the files README.md, xduts.dtx, and xduts.ins
+%% and the derived files xduts.pdf, xduugthesis.cls, and xdufont.sty.
+%%
+%% The copyright of xidian-text.pdf and xidian-logo.pdf is Xidian University.
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{xdufont}
- {2022/04/11}{0.7.0.0}
+ {2022/04/16}{1.2.0.0}
{Xidian University Font package}
\RequirePackage { xparse, l3keys2e }
\PassOptionsToPackage { quiet } { xeCJK }
\RequirePackage { xeCJK }
\tl_new:N \l__xdu_cjk_font_tl
-\str_new:N \l__xdu_fake_bold_str
-\str_new:N \l__xdu_fake_slant_str
+\tl_new:N \l__xdu_fake_bold_tl
+\tl_new:N \l__xdu_fake_slant_tl
\tl_new:N \l__xdu_latin_font_tl
\tl_new:N \l__xdu_math_font_tl
\tl_new:N \l__xdu_unicode_math_tl
@@ -44,9 +46,9 @@
cjk-font .choices:nn =
{ win, adobe, founder, sinotype, fandol, none }
{ \tl_set_eq:NN \l__xdu_cjk_font_tl \l_keys_choice_tl },
- cjk-fake-bold .str_set:N = \l__xdu_fake_bold_str,
- cjk-fake-slant .str_set:N = \l__xdu_fake_slant_str,
- latin-font .choices:nn = { tacn, thcs, none }
+ cjk-fake-bold .tl_set:N = \l__xdu_fake_bold_tl,
+ cjk-fake-slant .tl_set:N = \l__xdu_fake_slant_tl,
+ latin-font .choices:nn = { tacn, thcs, gyre, none }
{ \tl_set_eq:NN \l__xdu_latin_font_tl \l_keys_choice_tl },
math-font .choices:nn =
{
@@ -61,14 +63,14 @@
}
\keys_set:nn { xdu }
{
- style / cjk-font = win,
- style / cjk-fake-bold = 3,
- style / cjk-fake-slant = 0.2,
- style / latin-font = tacn,
- style / math-font = cm,
- style / unicode-math = { },
- style / font-type = font,
- style / font-path = fonts
+ style / cjk-font = fandol,
+ style / cjk-fake-bold = 3,
+ style / cjk-fake-slant = 0.2,
+ style / latin-font = gyre,
+ style / math-font = cm,
+ style / unicode-math = { },
+ style / font-type = font,
+ style / font-path = fonts
}
\cs_new:Npn \__xdu_if_platform_macos:FT #1#2
{ \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } }
@@ -93,26 +95,26 @@
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fb:n #1
{
BoldFont = { #1 },
- BoldFeatures = { FakeBold = \l__xdu_fake_bold_str }
+ BoldFeatures = { FakeBold = \l__xdu_fake_bold_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fs:n #1
{
SlantedFont = { #1 },
- SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fbfs:n #1
{
BoldSlantedFont = { #1 },
BoldSlantedFeatures =
{
- FakeBold = \l__xdu_fake_bold_str,
- FakeSlant = \l__xdu_fake_slant_str
+ FakeBold = \l__xdu_fake_bold_tl,
+ FakeSlant = \l__xdu_fake_slant_tl
}
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_bfs:n #1
{
BoldSlantedFont = { #1 },
- BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_i:n #1
{
@@ -121,20 +123,20 @@
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fi:n #1
{
ItalicFont = { #1 },
- ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_ifb:n #1
{
BoldItalicFont = { #1 },
- BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_str }
+ BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fifb:n #1
{
BoldItalicFont = { #1 },
BoldItalicFeatures =
{
- FakeBold = \l__xdu_fake_bold_str,
- FakeSlant = \l__xdu_fake_slant_str
+ FakeBold = \l__xdu_fake_bold_tl,
+ FakeSlant = \l__xdu_fake_slant_tl
}
}
\cs_new:Npn \__xdu_cfg_cjk_font_r:n #1
@@ -250,30 +252,78 @@
\cs_new:Npn \__xdu_load_cjk_font_none: { }
\cs_new:Npn \__xdu_set_latin_font:nnn #1#2#3
{
- \__xdu_font_path:
BoldFont = { #1 },
SlantedFont = { #2 },
BoldSlantedFont = { #3 },
ItalicFont = { #2 },
BoldItalicFont = { #3 }
}
+\cs_new:Npn \__xdu_set_latin_scale:
+ { Scale = MatchLowercase , }
+\cs_new:Npn \__xdu_off_latin_ligatures:
+ { Ligatures = CommonOff , }
\cs_new:Npn \__xdu_set_latin_main_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
{ \setmainfont { #1 } }
- { \setmainfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ {
+ \setmainfont { #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
\cs_new:Npn \__xdu_set_latin_sans_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
- { \setsansfont { #1 } }
- { \setsansfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setsansfont { #1 } [ \__xdu_set_latin_scale: ] }
+ {
+ \setsansfont { #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_scale:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
\cs_new:Npn \__xdu_set_latin_mono_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
- { \setmonofont{ #1 } }
- { \setmonofont{ #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setmonofont{ #1 } [ \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: ]}
+ {
+ \setmonofont{ #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_scale:
+ \__xdu_off_latin_ligatures:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
+ }
+\cs_new:Npn \__xdu_set_latin_main_font:nnnn #1#2#3#4
+ {
+ \setmainfont { #1 }
+ [
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+\cs_new:Npn \__xdu_set_latin_sans_font:nnnn #1#2#3#4
+ {
+ \setsansfont { #1 }
+ [
+ \__xdu_set_latin_scale:
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+\cs_new:Npn \__xdu_set_latin_mono_font:nnnn #1#2#3#4
+ {
+ \setmonofont{ #1 }
+ [
+ \__xdu_set_latin_scale:
+ \__xdu_off_latin_ligatures:
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
}
\cs_new:Npn \__xdu_load_latin_font_tacn:
{
@@ -305,6 +355,24 @@
{ CourierStd-Oblique.otf }
{ CourierStd-BoldOblique.otf }
}
+\cs_new:Npn \__xdu_load_latin_font_gyre:
+ {
+ \__xdu_set_latin_main_font:nnnn
+ { texgyretermes-regular.otf }
+ { texgyretermes-bold.otf }
+ { texgyretermes-italic.otf }
+ { texgyretermes-bolditalic.otf }
+ \__xdu_set_latin_sans_font:nnnn
+ { texgyreheros-regular.otf }
+ { texgyreheros-bold.otf }
+ { texgyreheros-italic.otf }
+ { texgyreheros-bolditalic.otf }
+ \__xdu_set_latin_mono_font:nnnn
+ { texgyrecursor-regular.otf }
+ { texgyrecursor-bold.otf }
+ { texgyrecursor-italic.otf }
+ { texgyrecursor-bolditalic.otf }
+ }
\cs_new:Npn \__xdu_load_latin_font_none: { }
\cs_new:Npn \__xdu_load_unicode_math_pkg:
{
diff --git a/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls b/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls
index edb14f92ad7..4236cdc5506 100644
--- a/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls
+++ b/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls
@@ -6,27 +6,29 @@
%%
%% xduts.dtx (with options: `class,xduugthesis')
%%
-%% Copyright (C) 2022--2022 by @note286 in GitHub
-%% ---------------------------------------------------------------------
+%% Copyright 2022--2022 by @note286 in GitHub and CTAN
%%
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either
-%% version 1.3c of this license or (at your option) any later
-%% version. This version of this license is in
-%% http://www.latex-project.org/lppl/lppl-1-3c.txt
-%% and the latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of
-%% LaTeX version 2005/12/01 or later.
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
%%
-%% This work has the LPPL maintenance status "maintained".
+%% This work has the LPPL maintenance status `author-maintained'.
%%
-%% ---------------------------------------------------------------------
+%% The Current Maintainer of this work is @note286 in GitHub and CTAN.
+%%
+%% This work consists of the files README.md, xduts.dtx, and xduts.ins
+%% and the derived files xduts.pdf, xduugthesis.cls, and xdufont.sty.
+%%
+%% The copyright of xidian-text.pdf and xidian-logo.pdf is Xidian University.
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{xduugthesis}
- {2022/04/11}{0.7.0.0}
+ {2022/04/16}{1.2.0.0}
{Xidian University Undergraduate Thesis document class}
\RequirePackage { xparse, l3keys2e }
\PassOptionsToPackage { quiet } { xeCJK }
@@ -45,8 +47,8 @@
\RequirePackage { xeCJKfntef }
\RequirePackage { graphicx }
\tl_new:N \l__xdu_cjk_font_tl
-\str_new:N \l__xdu_fake_bold_str
-\str_new:N \l__xdu_fake_slant_str
+\tl_new:N \l__xdu_fake_bold_tl
+\tl_new:N \l__xdu_fake_slant_tl
\tl_new:N \l__xdu_latin_font_tl
\tl_new:N \l__xdu_math_font_tl
\tl_new:N \l__xdu_unicode_math_tl
@@ -57,9 +59,9 @@
cjk-font .choices:nn =
{ win, adobe, founder, sinotype, fandol, none }
{ \tl_set_eq:NN \l__xdu_cjk_font_tl \l_keys_choice_tl },
- cjk-fake-bold .str_set:N = \l__xdu_fake_bold_str,
- cjk-fake-slant .str_set:N = \l__xdu_fake_slant_str,
- latin-font .choices:nn = { tacn, thcs, none }
+ cjk-fake-bold .tl_set:N = \l__xdu_fake_bold_tl,
+ cjk-fake-slant .tl_set:N = \l__xdu_fake_slant_tl,
+ latin-font .choices:nn = { tacn, thcs, gyre, none }
{ \tl_set_eq:NN \l__xdu_latin_font_tl \l_keys_choice_tl },
math-font .choices:nn =
{
@@ -74,14 +76,14 @@
}
\keys_set:nn { xdu }
{
- style / cjk-font = win,
- style / cjk-fake-bold = 3,
- style / cjk-fake-slant = 0.2,
- style / latin-font = tacn,
- style / math-font = cm,
- style / unicode-math = { },
- style / font-type = font,
- style / font-path = fonts
+ style / cjk-font = fandol,
+ style / cjk-fake-bold = 3,
+ style / cjk-fake-slant = 0.2,
+ style / latin-font = gyre,
+ style / math-font = cm,
+ style / unicode-math = { },
+ style / font-type = font,
+ style / font-path = fonts
}
\cs_new:Npn \__xdu_if_platform_macos:FT #1#2
{ \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } }
@@ -106,26 +108,26 @@
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fb:n #1
{
BoldFont = { #1 },
- BoldFeatures = { FakeBold = \l__xdu_fake_bold_str }
+ BoldFeatures = { FakeBold = \l__xdu_fake_bold_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fs:n #1
{
SlantedFont = { #1 },
- SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fbfs:n #1
{
BoldSlantedFont = { #1 },
BoldSlantedFeatures =
{
- FakeBold = \l__xdu_fake_bold_str,
- FakeSlant = \l__xdu_fake_slant_str
+ FakeBold = \l__xdu_fake_bold_tl,
+ FakeSlant = \l__xdu_fake_slant_tl
}
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_bfs:n #1
{
BoldSlantedFont = { #1 },
- BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_i:n #1
{
@@ -134,20 +136,20 @@
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fi:n #1
{
ItalicFont = { #1 },
- ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_str }
+ ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_ifb:n #1
{
BoldItalicFont = { #1 },
- BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_str }
+ BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_tl }
}
\cs_new:Npn \__xdu_cfg_cjk_font_sub_fifb:n #1
{
BoldItalicFont = { #1 },
BoldItalicFeatures =
{
- FakeBold = \l__xdu_fake_bold_str,
- FakeSlant = \l__xdu_fake_slant_str
+ FakeBold = \l__xdu_fake_bold_tl,
+ FakeSlant = \l__xdu_fake_slant_tl
}
}
\cs_new:Npn \__xdu_cfg_cjk_font_r:n #1
@@ -263,30 +265,78 @@
\cs_new:Npn \__xdu_load_cjk_font_none: { }
\cs_new:Npn \__xdu_set_latin_font:nnn #1#2#3
{
- \__xdu_font_path:
BoldFont = { #1 },
SlantedFont = { #2 },
BoldSlantedFont = { #3 },
ItalicFont = { #2 },
BoldItalicFont = { #3 }
}
+\cs_new:Npn \__xdu_set_latin_scale:
+ { Scale = MatchLowercase , }
+\cs_new:Npn \__xdu_off_latin_ligatures:
+ { Ligatures = CommonOff , }
\cs_new:Npn \__xdu_set_latin_main_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
{ \setmainfont { #1 } }
- { \setmainfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ {
+ \setmainfont { #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
\cs_new:Npn \__xdu_set_latin_sans_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
- { \setsansfont { #1 } }
- { \setsansfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setsansfont { #1 } [ \__xdu_set_latin_scale: ] }
+ {
+ \setsansfont { #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_scale:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
\cs_new:Npn \__xdu_set_latin_mono_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l__xdu_font_type_tl } { font }
- { \setmonofont{ #1 } }
- { \setmonofont{ #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setmonofont{ #1 } [ \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: ]}
+ {
+ \setmonofont{ #2 }
+ [
+ \__xdu_font_path:
+ \__xdu_set_latin_scale:
+ \__xdu_off_latin_ligatures:
+ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
+ }
+\cs_new:Npn \__xdu_set_latin_main_font:nnnn #1#2#3#4
+ {
+ \setmainfont { #1 }
+ [
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+\cs_new:Npn \__xdu_set_latin_sans_font:nnnn #1#2#3#4
+ {
+ \setsansfont { #1 }
+ [
+ \__xdu_set_latin_scale:
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+\cs_new:Npn \__xdu_set_latin_mono_font:nnnn #1#2#3#4
+ {
+ \setmonofont{ #1 }
+ [
+ \__xdu_set_latin_scale:
+ \__xdu_off_latin_ligatures:
+ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
}
\cs_new:Npn \__xdu_load_latin_font_tacn:
{
@@ -318,6 +368,24 @@
{ CourierStd-Oblique.otf }
{ CourierStd-BoldOblique.otf }
}
+\cs_new:Npn \__xdu_load_latin_font_gyre:
+ {
+ \__xdu_set_latin_main_font:nnnn
+ { texgyretermes-regular.otf }
+ { texgyretermes-bold.otf }
+ { texgyretermes-italic.otf }
+ { texgyretermes-bolditalic.otf }
+ \__xdu_set_latin_sans_font:nnnn
+ { texgyreheros-regular.otf }
+ { texgyreheros-bold.otf }
+ { texgyreheros-italic.otf }
+ { texgyreheros-bolditalic.otf }
+ \__xdu_set_latin_mono_font:nnnn
+ { texgyrecursor-regular.otf }
+ { texgyrecursor-bold.otf }
+ { texgyrecursor-italic.otf }
+ { texgyrecursor-bolditalic.otf }
+ }
\cs_new:Npn \__xdu_load_latin_font_none: { }
\cs_new:Npn \__xdu_load_unicode_math_pkg:
{
@@ -435,7 +503,10 @@
\tl_new:N \l__xdu_lang_tl
\tl_new:N \l__xdu_bib_tool_tl
\clist_new:N \l__xdu_bib_file_clist
-\tl_new:N \l__xdu_fig_label_sep_tl
+\tl_new:N \l__xdu_ref_add_space
+\tl_new:N \l__xdu_cap_label_sep_tl
+\bool_new:N \l__xdu_tab_small_bool
+\bool_new:N \l__xdu_alg_small_bool
\clist_new:N \l__xdu_before_skip_clist
\clist_new:N \l__xdu_after_skip_clist
\tl_new:N \l__xdu_chap_tl
@@ -444,6 +515,7 @@
\tl_new:N \l__xdu_subsubsec_tl
\tl_new:N \l__xdu_para_tl
\tl_new:N \l__xdu_subpara_tl
+\bool_new:N \l__xdu_sym_mgn_bool
\keys_define:nn { xdu / style }
{
en-cjk-font .bool_set:N = \l__xdu_en_cjk_font_bool,
@@ -452,7 +524,10 @@
bib-backend .choices:nn = { bibtex, biblatex }
{ \tl_set_eq:NN \l__xdu_bib_tool_tl \l_keys_choice_tl },
bib-resource .clist_set:N = \l__xdu_bib_file_clist,
- fig-label-sep .tl_set:N = \l__xdu_fig_label_sep_tl,
+ ref-add-space .bool_set:N = \l__xdu_ref_add_space,
+ caption-label-sep .tl_set:N = \l__xdu_cap_label_sep_tl,
+ table-small-font .bool_set:N = \l__xdu_tab_small_bool,
+ algorithm-small-font .bool_set:N = \l__xdu_alg_small_bool,
before-skip .clist_set:N = \l__xdu_before_skip_clist,
after-skip .clist_set:N = \l__xdu_after_skip_clist,
chap-zihao .tl_set:N = \l__xdu_chap_tl,
@@ -460,17 +535,22 @@
subsec-zihao .tl_set:N = \l__xdu_subsec_tl,
subsubsec-zihao .tl_set:N = \l__xdu_subsubsec_tl,
para-zihao .tl_set:N = \l__xdu_para_tl,
- subpara-zihao .tl_set:N = \l__xdu_subpara_tl
+ subpara-zihao .tl_set:N = \l__xdu_subpara_tl,
+ symmetric-margin .bool_set:N = \l__xdu_sym_mgn_bool
}
\keys_set:nn { xdu }
{
- style / en-cjk-font = false,
- style / language = zh,
- style / bib-backend = biblatex,
- style / bib-resource = { },
- style / fig-label-sep = { 0.75em },
- style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt },
- style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt }
+ style / en-cjk-font = false,
+ style / language = zh,
+ style / bib-backend = biblatex,
+ style / bib-resource = { },
+ style / ref-add-space = false,
+ style / caption-label-sep = { 0.75em },
+ style / table-small-font = true,
+ style / algorithm-small-font = true,
+ style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt },
+ style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt },
+ style / symmetric-margin = false
}
\NewDocumentCommand \xdusetup { m }
{ \keys_set:nn { xdu } { #1 } }
@@ -523,18 +603,30 @@
\chapter* { #1 }
\markboth { #1 } { }
}
-\cs_new:Npn \__xdu_n_chapter_head:nn #1#2
+\cs_new:Npn \__xdu_n_chapter_head_ii:nn #1#2
{
{
\ctexset { chapter / format = { #2 } }
\__xdu_n_chapter_head:n { #1 }
}
}
+\cs_new:Npn \__xdu_n_chapter_head:nn #1#2
+ {
+ \__xdu_add_bookmark:n { #1 }
+ \chapter* { #2 }
+ \markboth { #1 } { }
+ }
\cs_new:Npn \__xdu_n_chapter_head_toc:n #1
{
\__xdu_add_toc:n { #1 }
- \chapter* { #1 }
- \markboth { #1 } { }
+ \chapter* { #1 }
+ \markboth { #1 } { }
+ }
+\cs_new:Npn \__xdu_n_chapter_head_toc:nn #1#2
+ {
+ \__xdu_add_toc:n { #1 }
+ \chapter* { #2 }
+ \markboth { #1 } { }
}
\cs_new:Npn \__xdu_typeout_keywords:nNn #1#2#3
{
@@ -565,12 +657,28 @@
\savegeometry { main }
\newgeometry
{
+ top = 3cm,
+ bottom = 2cm,
+ inner = 3cm,
+ outer = 3cm,
+ head = 2cm,
+ foot = 1cm
+ }
+\savegeometry { main-sym }
+\newgeometry
+ {
top = 2.5cm,
- bottom = 2.5cm,
+ bottom = 2cm,
inner = 3cm,
outer = 2cm
}
\savegeometry { cover }
+\cs_new:Npn \__xdu_load_main_geometry:
+ {
+ \bool_if:NTF \l__xdu_sym_mgn_bool
+ { \loadgeometry { main-sym } }
+ { \loadgeometry { main } }
+ }
\renewcommand { \chaptermark } [ 1 ]
{
\markboth
@@ -722,16 +830,99 @@
}
{ \renewcommand { #1 } { \__xdu_rm_family: \zihao { -4 } } }
\renewcommand { \theequation } { \thechapter - \arabic { equation } }
+\ctex_at_end_preamble:n
+ {
+ \clist_map_inline:nn
+ {
+ { \algorithmname },
+ { \ALG@name },
+ { \algorithmcfname }
+ }
+ { \cs_set:Npn #1 { \__xdu_lang_switch:nn { 算法 } { Algorithm } } }
+ }
+\PassOptionsToPackage { chapter } { algorithm }
+\ctex_at_end_preamble:n
+ {
+ \@ifpackageloaded { algorithm }
+ {
+ \cs_if_exist:NT \thealgorithm
+ {
+ \floatplacement { algorithm } { tbp }
+ \cs_set:Npn \thealgorithm { \thechapter . \arabic { algorithm } }
+ \bool_if:NT \l__xdu_alg_small_bool
+ {
+ \renewenvironment { algorithm }
+ {
+ \@nameuse { fst@algorithm }
+ \@float@setevery { algorithm }
+ \ctex_gadd_ltxhook:nn
+ { cmd/@floatboxreset/after }
+ { \zihao { 5 } }
+ \@float { algorithm }
+ }
+ { \float@end }
+ }
+ }
+ }
+ { }
+ }
+\PassOptionsToPackage { algochapter } { algorithm2e }
+\ctex_at_end_preamble:n
+ {
+ \@ifpackageloaded { algorithm2e }
+ {
+ \cs_if_exist:NT \thealgocf
+ {
+ \cs_set:Npn \thealgocf { \thechapter . \arabic { algocf } }
+ \renewenvironment { \algocf@envname } [ 1 ] [ tbp ]
+ {
+ \setboolean { algocf@algostar } { false }
+ \setboolean { algocf@procenvironment } { false }
+ \gdef \algocfautorefname { \algorithmautorefname }
+ \begin { algocf@algorithm } [ #1 ] \ignorespaces
+ }
+ { \end { algocf@algorithm } \ignorespacesafterend }
+ \bool_if:NT \l__xdu_alg_small_bool
+ { \SetAlFnt { \zihao { 5 } } }
+ }
+ }
+ { }
+ }
\RequirePackage { caption }
-\DeclareCaptionLabelSeparator { customskip } { \hskip \l__xdu_fig_label_sep_tl }
+\DeclareCaptionLabelSeparator { customskip } { \hskip \l__xdu_cap_label_sep_tl }
\DeclareCaptionFont { customfont } { \__xdu_rm_family: \zihao { 5 } }
\captionsetup
{
labelsep = customskip,
font = customfont
}
+\captionsetup [ algorithm ]
+ {
+ labelsep = customskip,
+ labelfont = customfont,
+ font = customfont
+ }
+\ctex_at_end_preamble:n
+ {
+ \cs_if_exist:NT \thealgocf
+ {
+ \SetAlgoCaptionSeparator { \hbox_to_wd:nn { \l__xdu_cap_label_sep_tl } { } }
+ \SetAlCapNameFnt { \__xdu_rm_family: \zihao { 5 } }
+ \SetAlCapFnt { \__xdu_rm_family: \zihao { 5 } }
+ \SetAlCapSty { }
+ }
+ }
\PassOptionsToPackage { font = small } { subfig }
\captionsetup [ sub ] { font = customfont }
+\ctex_at_end_preamble:n
+ {
+ \bool_if:NT \l__xdu_tab_small_bool
+ {
+ \renewenvironment { table }
+ { \def\@floatboxreset { \reset@font\small\@setminipage } \@float { table } }
+ { \end@float }
+ }
+ }
\RequirePackage{hyperref}
\hypersetup
{
@@ -747,6 +938,28 @@
pdfauthor = \l__xdu_author_str
}
}
+\ctex_at_end_preamble:n
+ {
+ \bool_if:NT \l__xdu_ref_add_space
+ {
+ \str_if_eq:NNT { \l__xdu_lang_tl } { zh }
+ {
+ \RequirePackage { xspace }
+ \xspaceaddexceptions { 。?!,、;:“”‘’—….--~·《》<>_ }
+ \cs_generate_variant:Nn \str_if_in:nnTF { xnTF }
+ \ctex_after_end_preamble:n
+ {
+ \cs_set_eq:NN \__xdu_trad_ref:n \ref
+ \cs_set:Npn \ref #1
+ {
+ \str_if_in:xnTF { \__hyp_get_anchor:n { #1 } } { chapter }
+ { \__xdu_trad_ref:n { #1 } }
+ { \xspace \__xdu_trad_ref:n { #1 } \xspace }
+ }
+ }
+ }
+ }
+ }
\cs_new_protected:Npn \__xdu_begin_document:n #1
{ \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } }
\__xdu_begin_document:n
@@ -768,6 +981,10 @@
\appendix
\renewcommand { \thefigure } { \thechapter \arabic { figure } }
\renewcommand { \thetable } { \thechapter \arabic { table } }
+ \cs_if_exist:NT \thealgorithm
+ { \cs_set:Npn \thealgorithm { \thechapter \arabic { algorithm } } }
+ \cs_if_exist:NT \thealgocf
+ { \cs_set:Npn \thealgocf { \thechapter \arabic { algocf } } }
\BODY
}
\cs_new:Npn \__xdu_cover_i:nn #1#2
@@ -834,13 +1051,21 @@
}
}
\cs_generate_variant:Nn \__xdu_split_title:Nn { NV }
+\bool_new:N \l__xdu_is_ent_bool
+\bool_new:N \l__xdu_is_wide_bool
\ctex_at_end_preamble:n
{
+ \tl_if_blank:VF \l__xdu_supv_dept_str
+ { \bool_set_true:N \l__xdu_is_wide_bool }
+ \tl_if_blank:VF \l__xdu_supv_ent_str
+ { \bool_set_true:N \l__xdu_is_wide_bool }
+ \tl_if_blank:VF \l__xdu_supv_sch_str
+ { \bool_set_true:N \l__xdu_is_wide_bool }
\cs_new:Npn \__xdu_cover_iii:nnnn #1#2#3#4
{
- \tl_if_blank:VTF \l__xdu_supv_dept_str
- { \__xdu_cover_iii:nnnnn { 4em } { #1 } { #2 } { #3 } { #4 } }
+ \bool_if:NTF \l__xdu_is_wide_bool
{ \__xdu_cover_iii:nnnnn { 6em } { #1 } { #2 } { #3 } { #4 } }
+ { \__xdu_cover_iii:nnnnn { 4em } { #1 } { #2 } { #3 } { #4 } }
}
}
\renewcommand{\frontmatter}
@@ -866,7 +1091,11 @@
\__xdu_cover_iii:nnnn { 学院 } { rm } { -3 } { \l__xdu_dept_str }
\__xdu_cover_iii:nnnn { 专业 } { rm } { -3 } { \l__xdu_major_str }
\__xdu_cover_iii:nnnn { 学生姓名 } { rm } { -3 } { \l__xdu_author_str }
- \tl_if_blank:VTF \l__xdu_supv_str
+ \tl_if_blank:VF \l__xdu_supv_ent_str
+ { \bool_set_true:N \l__xdu_is_ent_bool }
+ \tl_if_blank:VF \l__xdu_supv_sch_str
+ { \bool_set_true:N \l__xdu_is_ent_bool }
+ \bool_if:NTF \l__xdu_is_ent_bool
{
\__xdu_cover_iii:nnnn { 校外导师姓名 } { rm } { -3 } { \l__xdu_supv_ent_str }
\__xdu_cover_iii:nnnn { 校内导师姓名 } { rm } { -3 } { \l__xdu_supv_sch_str }
@@ -883,10 +1112,12 @@
}
}
\cleardoublepage
- \loadgeometry { main }
+ \__xdu_load_main_geometry:
\pagestyle { plain }
\pagenumbering { Roman }
- \__xdu_n_chapter_head:n { 摘要 }
+ \__xdu_n_chapter_head:nn
+ { 摘要 }
+ { 摘 { \quad } 要 }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }
@@ -897,7 +1128,7 @@
\__xdu_typeout_keywords:nNn { 关键词: } { \l__xdu_keywords_zh_clist } { \qquad }
}
\cleardoublepage
- \__xdu_n_chapter_head:nn {ABSTRACT} { \rmfamily \zihao{3} \bfseries \centering }
+ \__xdu_n_chapter_head_ii:nn {ABSTRACT} { \rmfamily \zihao{3} \bfseries \centering }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }
@@ -909,14 +1140,15 @@
}
\cleardoublepage
\setcounter { tocdepth } { 5 }
- \tl_set:Nn \contentsname { \__xdu_lang_switch:nn { 目录 } { Contents } }
- \__xdu_add_bookmark:n { \contentsname }
- \tableofcontents
+ \__xdu_n_chapter_head:nn
+ { \__xdu_lang_switch:nn { 目录 } { Contents } }
+ { \__xdu_lang_switch:nn { 目 { \quad } 录 } { Contents } }
+ \@starttoc { toc }
\cleardoublepage
}
\renewcommand{\mainmatter}
{
- \loadgeometry { main }
+ \__xdu_load_main_geometry:
\pagestyle { plain }
\pagenumbering { arabic }
\dim_set:Nn \parindent { 2\ccwd }
@@ -924,7 +1156,9 @@
}
\renewcommand{\backmatter}
{
- \__xdu_n_chapter_head_toc:n { \__xdu_lang_switch:nn { 致谢 } { Acknowledgements } }
+ \__xdu_n_chapter_head_toc:nn
+ { \__xdu_lang_switch:nn { 致谢 } { Acknowledgements } }
+ { \__xdu_lang_switch:nn { 致 { \quad } 谢 } { Acknowledgements } }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }