From b271c582b2b57abb8c3a50fffe5222914c428084 Mon Sep 17 00:00:00 2001
From: Yu Xiong <181850195@smail.nju.edu.cn>
Date: Sun, 31 Jul 2022 13:42:58 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=8B=A5=E5=B9=B2?=
 =?UTF-8?q?=E5=85=AC=E5=BC=8F=E6=A0=B7=E5=BC=8F=E8=AE=BE=E7=BD=AE=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 source/njuthesis.dtx | 318 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 294 insertions(+), 24 deletions(-)

diff --git a/source/njuthesis.dtx b/source/njuthesis.dtx
index 7e72cd7..0866482 100644
--- a/source/njuthesis.dtx
+++ b/source/njuthesis.dtx
@@ -3250,6 +3250,14 @@ To produce the documentation run the original source files ending with
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_at_begin_document:n}
+% 灏佽 \LaTeX{} 鐨勯挬瀛愮鐞嗘満鍒讹紝绛夋晥浜� \tn{AtBeginDocument}銆�
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_at_begin_document:n #1
+  { \hook_gput_next_code:nn { begindocument } { #1 } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsubsection{灏侀潰鐩稿叧}
 % \changes{v0.16}{2022/03/10}{灏嗗皝闈㈠拰鎽樿鍐呴儴鍑芥暟瀹氫箟绉诲姩鍒板墠閮ㄣ€倉
 %
@@ -3754,9 +3762,7 @@ To produce the documentation run the original source files ending with
 %
 % \begin{macro}{latin-font,cjk-font}
 % \changes{v0.14}{2021/12/12}{绠€鍖栧瓧浣撻€夐」鍚嶇О銆倉
-% \begin{macro}{math-font}
-% \changes{v1.0}{2022/07/02}{澧炲姞鏁板瀛楀簱閫夋嫨鍔熻兘銆倉
-% 瀛椾綋閫夐」銆�
+% 涓嫳鏂囧瓧浣撻€夐」銆�
 %    \begin{macrocode}
     latin-font        .choices:nn =
       { gyre, mac, win, none }
@@ -3764,10 +3770,17 @@ To produce the documentation run the original source files ending with
     cjk-font          .choices:nn =
       { fandol, founder, mac, noto, source, win, none }
       { \tl_set_eq:NN \g_@@_font_cjk_tl   \l_keys_choice_tl },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math-font}
+% \changes{v1.0}{2022/07/02}{澧炲姞鏁板瀛楀簱閫夋嫨鍔熻兘銆倉
+% 鏁板瀛椾綋閫夐」銆�
+%    \begin{macrocode}
     math-font         .choices:nn =
       {
-        asana, cambria, fira, garamond, lm, libertinus, stix,
-        bonum, dejavu, pagella, schola, termes, xits, none
+        asana, cambria, fira, garamond, lm, libertinus, newcm,
+        stix, bonum, dejavu, pagella, schola, termes, xits, none
       }
       { \tl_set_eq:NN \g_@@_font_math_tl  \l_keys_choice_tl },
 %    \end{macrocode}
@@ -3905,6 +3918,7 @@ To produce the documentation run the original source files ending with
     % footnote .meta:nn = { nju / footnote } { #1 },
     % header   .meta:nn = { nju / header   } { #1 },
     info     .meta:nn = { nju / info     } { #1 },
+    math     .meta:nn = { nju / math     } { #1 },
     style    .meta:nn = { nju / style    } { #1 },
     theorem  .meta:nn = { nju / theorem  } { #1 }
     % toc      .meta:nn = { nju / toc      } { #1 }
@@ -3919,6 +3933,10 @@ To produce the documentation run the original source files ending with
 \NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } }
 %    \end{macrocode}
 % \end{macro}
+% \tn{njusetup} 浠呰兘鍦ㄥ瑷€鍖轰娇鐢ㄣ€�
+%    \begin{macrocode}
+\@onlypreamble \njusetup
+%    \end{macrocode}
 %
 % \begin{macro}{\njusetformat}
 % \changes{v0.17}{2022/04/09}{鎻愪緵淇敼榛樿鏍峰紡鐨勬帴鍙c€倉
@@ -4821,34 +4839,87 @@ To produce the documentation run the original source files ending with
 % \end{macro}
 %
 % \begin{macro}{\@@_loadfont_math_xits:}
-% XITS Math 瀛椾綋閰嶇疆銆�
+% XITS Math 瀛椾綋銆�
 %    \begin{macrocode}
 \cs_new:Npn \@@_loadfont_math_xits:
   {
-    \ctex_if_platform_macos:TF
+    \bool_if:NTF \g_@@_opt_math_int_bool
+      { \tl_set:Nn  \l_@@_tmpa_tl { 8 } }
+      { \tl_clear:N \l_@@_tmpa_tl       }
+    \__um_setmathfont:nn
       {
-        \setmathfont { XITSMath-Regular.otf }
-        \setmathfont { XITSMath-Bold.otf    }
-          [ range= { bfup -> up, bfit -> it } ]
+        Extension    = .otf,
+        StylisticSet = \l_@@_tmpa_tl,
+        BoldFont     = XITSMath-Bold
       }
-      { \setmathfont { XITS~Math } }
+      { XITSMath-Regular }
+    \__um_setmathfont:nn
+      {
+        Extension    = .otf,
+        StylisticSet = 1,
+        range        = {cal,bfcal}
+      }
+      { XITSMath-Regular }
   }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_loadfont_math_none:}
-% 涓嶈繘琛屾暟瀛﹀瓧浣撻厤缃€�
+% \begin{macro}{\@@_loadfont_math_newcm:}
+% New Computer Modern Math 瀛椾綋銆�
 %    \begin{macrocode}
-\cs_new:Npn \@@_loadfont_math_none: { }
+\cs_new:Npn \@@_loadfont_math_newcm:
+  {
+    \bool_if:NTF \g_@@_opt_math_int_bool
+      { \tl_set:Nn  \l_@@_tmpa_tl { 2 } }
+      { \tl_clear:N \l_@@_tmpa_tl       }
+    \__um_setmathfont:nn
+      {
+        Extension      = .otf,
+        StylisticSet   = \l_@@_tmpa_tl
+      }
+      { NewCMMath-Book }
+    \__um_setmathfont:nn
+      {
+        Extension      = .otf,
+        StylisticSet   = 1,
+        range          = {scr,bfscr}
+      }
+      { NewCMMath-Book }
+    \__fontspec_main_setmathrm:nn
+      {
+        Extension      = .otf,
+        UprightFont    = *-Book,
+        BoldFont       = *-Bold,
+        ItalicFont     = *-BookItalic,
+        BoldItalicFont = *-BoldItalic
+      }
+      { NewCM10 }
+    \__fontspec_main_setmathsf:nn
+      {
+        Extension      = .otf,
+        UprightFont    = *-Book,
+        BoldFont       = *-Bold,
+        ItalicFont     = *-BookOblique,
+        BoldItalicFont = *-BoldOblique
+      }
+      { NewCMSans10 }
+    \__fontspec_main_setmathtt:nn
+      {
+        Extension      = .otf,
+        UprightFont    = *-Book,
+        ItalicFont     = *-BookItalic,
+        BoldFont       = *-Bold,
+        BoldItalicFont = *-BoldOblique
+      }
+      { NewCMMono10 }
+  }
 %    \end{macrocode}
 % \end{macro}
 %
-%
-% \begin{macro}{\@@_loadfont_math_cm:}
-% \pkg{unicode-math} 榛樿閲囩敤 Computer Modern Math 瀛椾綋锛�
-% 鍥犳鏃犻渶棰濆瀹氫箟銆�
+% \begin{macro}{\@@_loadfont_math_none:}
+% 涓嶈繘琛屾暟瀛﹀瓧浣撻厤缃€�
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_loadfont_math_cm: \@@_loadfont_math_none:
+\cs_new:Npn \@@_loadfont_math_none: { }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -4863,8 +4934,6 @@ To produce the documentation run the original source files ending with
   {
     \use:c { @@_loadfont_latin_ \g_@@_font_latin_tl : }
     \use:c { @@_loadfont_cjk_   \g_@@_font_cjk_tl   : }
-    \@@_if_um_loaded:T
-      { \use:c { @@_loadfont_math_ \g_@@_font_math_tl : } }
 %    \end{macrocode}
 % 鑷瀹氫箟 \pkg{ctex} 涓殑鍥涚被瀛椾綋鍛戒护銆�
 %    \begin{macrocode}
@@ -4880,7 +4949,7 @@ To produce the documentation run the original source files ending with
 %    \end{macrocode}
 % \end{macro}
 %
-% 杞藉叆璁剧疆鐨勫瓧浣撱€傛澶勮缃笌鏂囨。绫讳竴鍚岃浇鍏ワ紝鍚﹀垯鍦ㄥ瑷€鍖哄悗杞藉叆瀛椾綋鍙兘瀵艰嚧涓€閮ㄥ垎瑕嗙洊瀛椾綋鐨勫懡浠ゅけ鏁堛€�
+% 杞藉叆璁剧疆鐨勫瓧浣撱€備负浜嗗惛鏀跺瑷€鍖虹殑璁剧疆锛屾斁鍦ㄥ叾鍚庤浇鍏ャ€�
 %    \begin{macrocode}
 % \BeforeBeginEnvironment { document } { \@@_loadfont: }
 \@@_loadfont:
@@ -5549,7 +5618,6 @@ To produce the documentation run the original source files ending with
 %
 %
 % \subsection{瀹氱悊鐜}
-%
 % \changes{v0.18}{2022/04/21}{鏂板瀹氱悊鐜鐨勮嫢骞插畾鍒堕」銆倉
 %
 % \begin{macro}{theorem/style,theorem/header-font,theorem/body-font,
@@ -5631,6 +5699,208 @@ To produce the documentation run the original source files ending with
         \@@_ntheorem_post_setup:
       }
   }
+%    \end{macrocode}
+%
+%
+% \subsection{鍏紡鏍峰紡}
+% \changes{v1.0}{2022/07/31}{鏂板鑻ュ共鍏紡鏍峰紡璁剧疆銆倉
+%
+% \begin{variable}{\g_@@_opt_math_int_bool}
+% 鏄惁浣跨敤鐩寸珛绉垎鍙枫€�
+%    \begin{macrocode}
+\bool_new:N \g_@@_opt_math_int_bool
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_opt_math_re_bool}
+% 鏄惁浣跨敤缃楅┈浣撳疄閮ㄨ櫄閮ㄧ鍙枫€�
+%    \begin{macrocode}
+\bool_new:N \g_@@_opt_math_re_bool
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_opt_math_leq_bool}
+% 鏄惁浣跨敤鍊炬枩鐨勫皬浜庣瓑浜庡彿銆�
+%    \begin{macrocode}
+\bool_new:N \g_@@_opt_math_leq_bool
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_name_integral_tl}
+% 淇濆瓨 \pkg{unicode-math} 鍐呯疆鐨勬墍鏈夌Н鍒嗗彿鍛戒护銆�
+%    \begin{macrocode}
+\tl_const:Nx \c_@@_name_integral_tl { \l__um_nolimits_tl }
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_um_setup:n}
+% 灏佽 \cs{unimathsetup}銆�
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_um_setup:n #1
+  { \keys_set:nn { unicode-math } { #1 } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_loadfont_math:}
+% 鍔犺浇閫夊畾鏁板瀛椾綋銆�
+%    \begin{macrocode}
+\cs_new_eq:Nc \@@_loadfont_math:
+  { @@_loadfont_math_ \g_@@_font_math_tl : }
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A 閫夐」鍚嶇О鏉ヨ嚜 thuthesis
+%    \begin{macrocode}
+\keys_define:nn { nju / math }
+  {
+%    \end{macrocode}
+% \begin{macro}{math/uppercase-greek}
+%    \begin{macrocode}
+    uppercase-greek               .choice:,
+    uppercase-greek / italic        .code:n =
+      { \@@_um_setup:n { math-style = TeX } },
+    uppercase-greek / upright       .code:n =
+      { \@@_um_setup:n { math-style = ISO } },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/less-than-or-equal}
+%    \begin{macrocode}
+    less-than-or-equal            .choice:,
+    less-than-or-equal / slanted    .code:n =
+      { \bool_set_true:N  \g_@@_opt_math_leq_bool },
+    less-than-or-equal / horizontal .code:n =
+      { \bool_set_false:N \g_@@_opt_math_leq_bool },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/integral}
+%    \begin{macrocode}
+    integral                      .choice:,
+    integral / upright              .code:n =
+      { \bool_set_true:N  \g_@@_opt_math_int_bool },
+    integral / slanted              .code:n =
+      { \bool_set_false:N \g_@@_opt_math_int_bool },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/integral-limits}
+% 涓や釜閫夐」鍒嗗埆鐩稿綋浜� \tn{removenolimits} 鍜� \tn{addnolimits}銆�
+%    \begin{macrocode}
+    integral-limits               .choice:,
+    integral-limits / true          .code:n =
+      { \tl_set_eq:NN \l__um_nolimits_tl \c_@@_name_integral_tl },
+    integral-limits / false         .code:n =
+      { \tl_clear:N   \l__um_nolimits_tl },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/partial}
+%    \begin{macrocode}
+    partial                       .choice:,
+    partial / upright               .code:n =
+      { \@@_um_setup:n { partial = upright } },
+    partial / italic                .code:n =
+      { \@@_um_setup:n { partial = italic  } },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/math-ellipsis}
+%    \begin{macrocode}
+    math-ellipsis                 .choice:,
+    math-ellipsis / centered        .code:n =
+      {
+        \DeclareRobustCommand \mathellipsis
+          { \mathinner { \unicodecdots    } }
+      },
+    math-ellipsis / lower           .code:n =
+      {
+        \DeclareRobustCommand \mathellipsis
+          { \mathinner { \unicodeellipsis } }
+      },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/real-part}
+%    \begin{macrocode}
+    real-part                     .choice:,
+    real-part / roman               .code:n =
+      { \bool_set_true:N  \g_@@_opt_math_re_bool },
+    real-part / fraktur             .code:n =
+      { \bool_set_false:N \g_@@_opt_math_re_bool },
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{math/style}
+% 鏁翠綋鏍峰紡銆�
+%    \begin{macrocode}
+    style                      .choice:,
+    style / TeX                  .code:n =
+      {
+        \keys_set:nn { nju / math }
+          {
+            integral           = slanted,
+            integral-limits    = false,
+            less-than-or-equal = horizontal,
+            math-ellipsis      = centered,
+            partial            = italic,
+            real-part          = fraktur,
+            uppercase-greek    = upright
+          }
+        \@@_um_setup:n { bold-style = TeX }
+        \@@_loadfont_math:
+      },
+    style / ISO                  .code:n =
+      {
+        \keys_set:nn { nju / math }
+          {
+            integral           = upright,
+            integral-limits    = true,
+            less-than-or-equal = horizontal,
+            math-ellipsis      = lower,
+            partial            = upright,
+            real-part          = roman,
+            uppercase-greek    = italic
+          }
+        \@@_um_setup:n { bold-style = ISO }
+        \@@_loadfont_math:
+      },
+    style / GB                   .code:n =
+      {
+        \keys_set:nn { nju / math }
+          {
+            integral           = upright,
+            integral-limits    = false,
+            less-than-or-equal = slanted,
+            math-ellipsis      = centered,
+            partial            = upright,
+            real-part          = roman,
+            uppercase-greek    = italic
+          }
+        \@@_um_setup:n { bold-style = ISO }
+        \@@_loadfont_math:
+      },
+    style                     .initial:n = GB
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\@@_at_begin_document:n
+  {
+    \bool_if:NT \g_@@_opt_math_leq_bool
+      {
+        \cs_set_eq:NN \le  \leslant
+        \cs_set_eq:NN \ge  \geslant
+        \cs_set_eq:NN \leq \leqslant
+        \cs_set_eq:NN \geq \geqslant
+      }
+    \bool_if:NT \g_@@_opt_math_re_bool
+      {
+        \cs_set:Npn \Re { \operatorname { Re } }
+        \cs_set:Npn \Im { \operatorname { Im } }
+      }
+  }
 %</class>
 %    \end{macrocode}
 %
@@ -6136,7 +6406,7 @@ To produce the documentation run the original source files ending with
     \c_@@_name_chairman_tl \@@_hskip:
     \@@_ulined_center_box:nn { 9 em } { \g_@@_info_chairman_tl } \\
     \c_@@_name_reviewer_tl \@@_hskip:
-    \@@_multiline_box:NNNn \l_@@_tmpa_int \l_@@_tmpb_int
+    \@@_multiline_box:NNNn \l_@@_tmpa_int, \l_@@_tmpb_int
       \g_@@_info_reviewer_clist { 9 em }
   }
 %    \end{macrocode}
-- 
GitLab