From b02a3ff44730e8ac538905d233363962f44387d0 Mon Sep 17 00:00:00 2001 From: sikouhjw <489765924@qq.com> Date: Sat, 26 Jun 2021 19:24:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A5=BF=E6=96=87=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=80=89=E9=A1=B9=E3=80=81=E6=8A=91=E5=88=B6=20`backg?= =?UTF-8?q?round`=20=E7=9A=84=E8=AD=A6=E5=91=8A=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=BF=87=E6=97=B6=E5=AE=8F=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gdutthesis.cls | 165 +++++++++++++++++++++++++++++++++++-- main.tex | 4 + user-manual/gdutthesis.dtx | 15 ++-- 3 files changed, 170 insertions(+), 14 deletions(-) diff --git a/gdutthesis.cls b/gdutthesis.cls index 8b4fede..3764c3f 100644 --- a/gdutthesis.cls +++ b/gdutthesis.cls @@ -60,6 +60,7 @@ \cs_new:Npn \__gdut_error:nn { \msg_error:nnn { gdutthesis } } \cs_new:Npn \__gdut_error:nx { \msg_error:nnx { gdutthesis } } \cs_new:Npn \__gdut_error:nnn { \msg_error:nnnn { gdutthesis } } +\cs_new:Npn \__gdut_error:nnnn { \msg_error:nnnnn { gdutthesis } } \cs_new:Npn \__gdut_warning:n { \msg_warning:nn { gdutthesis } } \cs_new:Npn \__gdut_warning:nn { \msg_warning:nnn { gdutthesis } } \cs_new:Npn \__gdut_warning:nxx { \msg_warning:nnxx { gdutthesis } } @@ -182,11 +183,13 @@ { \PassOptionsToPackage #1 } \RequirePackage { etoolbox } \LoadClass { ctexbook } +\@namedef{ver@everypage.sty}{9999/99/99} \RequirePackage { amsmath, unicode-math, geometry, + everypage-1x, background, fancyhdr, graphicx, @@ -333,17 +336,22 @@ \cs_new_protected:Npn \__gdut_check_package:nnn #1#2#3 { \@ifpackagelater {#1} {#2} - { } { \__gdut_error:nnn { package-too-old } {#1} {#3} } + { } { \__gdut_error:nnn { package-too-old } { Package } {#1} {#3} } + } +\cs_new_protected:Npn \__gdut_check_class:nnn #1#2#3 + { + \@ifclasslater {#1} {#2} + { } { \__gdut_error:nnnn { package-too-old } { Class } {#1} {#3} } } \__gdut_msg_new:nn { package-too-old } { - Package~ "#1"~ is~ too~ old. \\ - The~ gdutthesis~ class~ only~ supports~ "#1"~ with~ a~ version \\ - higher~ than~ v#2. \\\\ - Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your \\ - TeX~ package~ manager~ or~ from~ CTAN. + #1~ "#2"~ is~ too~ old. \\ + The~ fduthesis~ class~ only~ supports~ "#2" \\ + with~ a~ version~ higher~ than~ v#3. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ it \\ + using~ your~ TeX~ package~ manager~ or~ from~ CTAN. } -% \__gdut_check_package:nnn { ctex } { 2017/08/07 } { 2.4.10 } +\__gdut_check_class:nnn { ctexbook } { 2017/08/07 } { 2.4.10 } \__gdut_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e } \__gdut_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i } \sys_if_engine_xetex:T @@ -364,7 +372,7 @@ \keys_define:nn { gdut / style } { font .choices:nn = - { times, times*, none } + { garamond, libertinus, lm, palatino, times, times*, none } { \tl_set_eq:NN \g__gdut_fontset_tl \l_keys_choice_tl } } \keys_define:nn { gdut / style } @@ -420,6 +428,13 @@ } \clist_map_inline:nn { main, sans, mono, math } { \__gdut_set_font_helper:n {#1} } \clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \__gdut_set_font_helper:n {#1} } +\tl_new:N \g__gdut_font_family_libertinus_serif_tl +\tl_new:N \g__gdut_font_family_libertinus_sans_tl +\tl_new:N \g__gdut_font_style_libertinus_rm_tl +\tl_new:N \g__gdut_font_style_libertinus_bf_tl +\tl_new:N \g__gdut_font_style_libertinus_it_tl +\tl_new:N \g__gdut_font_style_libertinus_bfit_tl +\tl_new:N \g__gdut_font_style_libertinus_bfsl_tl \tl_new:N \g__gdut_font_family_xits_tl \tl_new:N \g__gdut_font_style_xits_rm_tl \tl_new:N \g__gdut_font_style_xits_bf_tl @@ -431,6 +446,27 @@ \tl_new:N \g__gdut_font_name_xits_tl \tl_new:N \g__gdut_font_name_xits_math_rm_tl \tl_new:N \g__gdut_font_name_xits_math_bf_tl +\fontspec_font_if_exist:nTF { LibertinusSerif-Regular.otf } + { + \tl_set:Nn \g__gdut_font_family_libertinus_serif_tl { LibertinusSerif } + \tl_set:Nn \g__gdut_font_family_libertinus_sans_tl { LibertinusSans } + \tl_set:Nn \g__gdut_font_family_libertinus_math_tl { LibertinusMath } + \tl_set:Nn \g__gdut_font_style_libertinus_rm_tl { Regular } + \tl_set:Nn \g__gdut_font_style_libertinus_bf_tl { Bold } + \tl_set:Nn \g__gdut_font_style_libertinus_it_tl { Italic } + \tl_set:Nn \g__gdut_font_style_libertinus_bfit_tl { BoldItalic } + \tl_set:Nn \g__gdut_font_style_libertinus_bfsl_tl { BoldOblique } + } + { + \tl_set:Nn \g__gdut_font_family_libertinus_serif_tl { libertinusserif } + \tl_set:Nn \g__gdut_font_family_libertinus_sans_tl { libertinussans } + \tl_set:Nn \g__gdut_font_family_libertinus_math_tl { libertinusmath } + \tl_set:Nn \g__gdut_font_style_libertinus_rm_tl { regular } + \tl_set:Nn \g__gdut_font_style_libertinus_bf_tl { bold } + \tl_set:Nn \g__gdut_font_style_libertinus_it_tl { italic } + \tl_set:Nn \g__gdut_font_style_libertinus_bfit_tl { bolditalic } + \tl_set:Nn \g__gdut_font_style_libertinus_bfsl_tl { bolditalic } + } \fontspec_font_if_exist:nTF { XITS-Regular.otf } { \tl_set:Nn \g__gdut_font_family_xits_tl { XITS } @@ -450,6 +486,101 @@ \tl_set:Nn \g__gdut_font_name_xits_math_rm_tl { xits-math } \tl_set:Nn \g__gdut_font_name_xits_math_bf_tl { xits-mathbold } } +\tl_set:Nx \g__gdut_font_name_libertinus_serif_tl + { \g__gdut_font_family_libertinus_serif_tl - \g__gdut_font_style_libertinus_rm_tl } +\tl_set:Nx \g__gdut_font_name_libertinus_sans_tl + { \g__gdut_font_family_libertinus_sans_tl - \g__gdut_font_style_libertinus_rm_tl } +\tl_set:Nx \g__gdut_font_name_libertinus_math_tl + { \g__gdut_font_family_libertinus_math_tl - \g__gdut_font_style_libertinus_rm_tl } +\tl_set:Nx \g__gdut_font_name_xits_tl + { \g__gdut_font_family_xits_tl - \g__gdut_font_style_xits_rm_tl } +\cs_new_protected:Npn \__gdut_load_font_garamond: + { + \__gdut_setmainfont:nn { EBGaramond } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic + } + \__gdut_setsansfont:nn { \g__gdut_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g__gdut_font_style_libertinus_rm_tl, + BoldFont = *-\g__gdut_font_style_libertinus_bf_tl, + ItalicFont = *-\g__gdut_font_style_libertinus_it_tl, + BoldItalicFont = *-\g__gdut_font_style_libertinus_bf_tl + } + \__gdut_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \__gdut_setmathfont:nn { Garamond-Math.otf } { } + } +\cs_new_protected:Npn \__gdut_load_font_libertinus: + { + \__gdut_setmainfont:nn { \g__gdut_font_family_libertinus_serif_tl } + { + Extension = .otf, + UprightFont = *-\g__gdut_font_style_libertinus_rm_tl, + BoldFont = *-\g__gdut_font_style_libertinus_bf_tl, + ItalicFont = *-\g__gdut_font_style_libertinus_it_tl, + BoldItalicFont = *-\g__gdut_font_style_libertinus_bfit_tl + } + \__gdut_setsansfont:nn { \g__gdut_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g__gdut_font_style_libertinus_rm_tl, + BoldFont = *-\g__gdut_font_style_libertinus_bf_tl, + ItalicFont = *-\g__gdut_font_style_libertinus_it_tl, + BoldItalicFont = *-\g__gdut_font_style_libertinus_bf_tl + } + \__gdut_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \__gdut_setmathfont:nn { \g__gdut_font_name_libertinus_math_tl .otf } { } + } +\cs_new_protected:Npn \__gdut_load_font_lm: + { \__gdut_setmathfont:nn { latinmodern-math.otf } { } } +\cs_new_protected:Npn \__gdut_load_font_palatino: + { + \__gdut_setmainfont:nn { texgyrepagella } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \__gdut_setsansfont:nn { \g__gdut_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g__gdut_font_style_libertinus_rm_tl, + BoldFont = *-\g__gdut_font_style_libertinus_bf_tl, + ItalicFont = *-\g__gdut_font_style_libertinus_it_tl, + BoldItalicFont = *-\g__gdut_font_style_libertinus_bf_tl, + Scale = MatchUppercase + } + \__gdut_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \__gdut_setmathfont:nn { texgyrepagella-math.otf } { } + } \cs_new_protected:Npn \__gdut_load_font_times: { \__gdut_setmainfont:nn { \g__gdut_font_family_xits_tl } @@ -1348,7 +1479,23 @@ } % 设置封面背景 \clist_const:Nn \c__gdut_background_clist - { \backgroundsetup{scale=0.4796,position={38.5cm,-25.7cm},contents={\includegraphics{cover-background/doctor.jpeg}}}, \backgroundsetup{scale=0.4787,position={38.5cm,-25.7cm},contents={\includegraphics{cover-background/master.jpeg}}}, \backgroundsetup{scale=0.38327,position={48.1cm,-32.1cm},contents={\includegraphics{cover-background/promaster.jpeg}}} } + { + \backgroundsetup{ + scale = 0.4796, + position = {38.5cm,-25.7cm}, + contents = { \includegraphics{cover-background/doctor.jpeg} } + }, + \backgroundsetup{ + scale = 0.4787, + position = {38.5cm,-25.7cm}, + contents = { \includegraphics{cover-background/master.jpeg} } + }, + \backgroundsetup{ + scale = 0.38327, + position = {48.1cm,-32.1cm}, + contents = { \includegraphics{cover-background/promaster.jpeg} } + } + } \cs_new_protected:Npn \__gdut_background_type: { \clist_item:Nn \c__gdut_background_clist diff --git a/main.tex b/main.tex index 993e064..a279da7 100644 --- a/main.tex +++ b/main.tex @@ -20,6 +20,10 @@ \gdutsetup{ style = { + % font = {garamond}, + % font = {libertinus}, + % font = {lm}, + % font = {palatino}, font = {times}, % font = {times*}, cjk-font = {fandol}, diff --git a/user-manual/gdutthesis.dtx b/user-manual/gdutthesis.dtx index f31f386..2001d8d 100644 --- a/user-manual/gdutthesis.dtx +++ b/user-manual/gdutthesis.dtx @@ -1012,7 +1012,7 @@ Copyright (C) 2017–2021 by Xiangdong Zeng . %^^A+ % \begin{function}{style/font} % \begin{fdusyntax}[emph={[1]font}] -% font = (*<(times)|times*|none>*) +% font = (**) % \end{fdusyntax} %^^A- % 设置西文字体(包括数学字体)。具体配置见表~\ref{tab:font}。 @@ -1030,13 +1030,18 @@ Copyright (C) 2017–2021 by Xiangdong Zeng . % \toprule % & \strong{正文字体} & \strong{无衬线字体} & \strong{等宽字体} & \strong{数学字体} \\ % \midrule -% |times| & XITS & TG Heros\tnote{a} & TG Cursor & XITS Math \\ -% |times*|\tnote{b} & Times New Roman & Arial & Courier New & XITS Math \\ +% |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\ +% |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\ +% |lm| & LM Roman & LM Sans & LM Mono & LM Math \\ +% |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\ +% |times| & XITS & TG Heros & TG Cursor & XITS Math \\ +% |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\ % \bottomrule % \end{tabular} % \begin{tablenotes} -% \item[a] “TG”是 TeX Gyre 的缩写。 -% \item[b] 本行中,Times New Roman、Arial 和 Courier New 是商业字体, +% \item[a] “LM”是 Latin Modern 的缩写。 +% \item[b] “TG”是 TeX Gyre 的缩写。 +% \item[c] 本行中,Times New Roman、Arial 和 Courier New 是商业字体, % 在 Windows 和 macOS 系统上均默认安装。 % \end{tablenotes} % \end{threeparttable}