|
16 | 16 | % |
17 | 17 | % \iffalse |
18 | 18 | %<*driver> |
19 | | -\ProvidesFile{hitszthesis.dtx}[2022/05/05 3.2.3 Dissertation Template for Harbin Institute of Technology, ShenZhen (HITSZ)] |
| 19 | +\ProvidesFile{hitszthesis.dtx}[2022/05/18 3.2.4 Dissertation Template for Harbin Institute of Technology, ShenZhen (HITSZ)] |
20 | 20 | \documentclass{ltxdoc} |
21 | 21 | \usepackage{dtx-style} |
22 | 22 |
|
|
25 | 25 | \RecordChanges |
26 | 26 |
|
27 | 27 | \begin{document} |
| 28 | + % 解决 unicode-math 宏包与 ltxdoc 不兼容的问题 |
| 29 | + % https://tex.stackexchange.com/questions/644510/vertical-bar-in-docstrip-file-changes-to-j-with-unicode-math/644551#644551 |
| 30 | +\ExplSyntaxOn |
| 31 | + |
| 32 | +\cs_set_protected:Npn \definepatchvertmathcode:n #1 { |
| 33 | + \cs_set_protected:Npn \patchvertmathcode { |
| 34 | + \mathcode `\| = #1 |
| 35 | + } |
| 36 | +} |
| 37 | +\cs_generate_variant:Nn \definepatchvertmathcode:n {x} |
| 38 | +\definepatchvertmathcode:x {\int_eval:n{ |
| 39 | + \mathcode`\| - (\mathcode`\| - "800) / "1000 * "1000 + "2000 |
| 40 | +}} |
| 41 | + |
| 42 | +\ExplSyntaxOff |
| 43 | + |
| 44 | +\makeatletter |
| 45 | +\apptocmd{\mod@math@codes}{\patchvertmathcode}{}{} |
| 46 | +\makeatother |
28 | 47 | \DocInput{\jobname.dtx} |
29 | 48 | \end{document} |
30 | 49 | %</driver> |
|
937 | 956 | %<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
938 | 957 | %<cls>\ProvidesClass{hitszthesis} |
939 | 958 | %<cfg>\ProvidesFile{hitszthesis.cfg} |
940 | | -%<cls|cfg>[2022/05/05 3.2.3 Dissertation Template for Harbin Institute of Technology, ShenZhen (HITSZ)] |
| 959 | +%<cls|cfg>[2022/05/18 3.2.4 Dissertation Template for Harbin Institute of Technology, ShenZhen (HITSZ)] |
941 | 960 | % \end{macrocode} |
942 | 961 | % |
943 | 962 | % \subsection{定义选项} |
|
1245 | 1264 | % 添加数学字体开关 |
1246 | 1265 | % \begin{macrocode} |
1247 | 1266 | \ifhitsz@newtxmath |
1248 | | - \RequirePackage{newtxmath} |
| 1267 | +% \end{macrocode} |
| 1268 | +% |
| 1269 | +% 修复只加载 \pkg{newtxmath} 宏包时 operator 及 \cs{mathrm} 等命令的显示错误, |
| 1270 | +% 见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/196}{Github 上的讨论}。 |
| 1271 | +% \changes{v3.2.4}{2022/5/18}{修复只加载 \pkg{newtxmath} 宏包时 operator 及 \cs{mathrm} 等命令的显示错误。} |
| 1272 | +% \begin{macrocode} |
| 1273 | + \let\hitsz@encodingdefault\encodingdefault |
| 1274 | + \let\hitsz@rmdefault\rmdefault |
| 1275 | + \let\hitsz@sfdefault\sfdefault |
| 1276 | + \let\hitsz@ttdefault\ttdefault |
| 1277 | + \def\encodingdefault{T1} |
| 1278 | + \renewcommand{\rmdefault}{ntxtlf} |
| 1279 | + \renewcommand{\sfdefault}{qhv} |
| 1280 | + \renewcommand{\ttdefault}{ntxtt} |
| 1281 | + \usepackage{newtxmath} |
| 1282 | + \let\encodingdefault\hitsz@encodingdefault |
| 1283 | + \let\rmdefault\hitsz@rmdefault |
| 1284 | + \let\sfdefault\hitsz@sfdefault |
| 1285 | + \let\ttdefault\hitsz@ttdefault |
1249 | 1286 | \else |
1250 | 1287 | \ifhitsz@mtprotwolite |
1251 | 1288 | \let\Bbbk\relax |
@@ -3334,9 +3371,26 @@ delim_1 "\\hspace*{\\fill}" |
3334 | 3371 | %<*dtx-style> |
3335 | 3372 | \ProvidesPackage{dtx-style} |
3336 | 3373 | \RequirePackage{hypdoc} |
3337 | | -\RequirePackage[UTF8,scheme=chinese,fontset=windowsnew]{ctex} |
3338 | | -\RequirePackage{newpxtext} |
3339 | | -\RequirePackage{newpxmath} |
| 3374 | +\RequirePackage[UTF8,scheme=chinese,fontset=windows]{ctex} |
| 3375 | + %\RequirePackage{newpxtext} |
| 3376 | + % 使用 otf 字体来规避 newpxtext 宏包的 bug. |
| 3377 | + \setmainfont{TeXGyrePagellaX}[ |
| 3378 | + Extension = .otf, |
| 3379 | + UprightFont = *-Regular, |
| 3380 | + BoldFont = *-Bold, |
| 3381 | + ItalicFont = *-Italic, |
| 3382 | + BoldItalicFont = *-BoldItalic, |
| 3383 | +] |
| 3384 | +\setsansfont{IBMPlexSansCondensed}[% |
| 3385 | + Extension = .otf, |
| 3386 | + UprightFont = *-Regular, |
| 3387 | + BoldFont = *-Bold, |
| 3388 | + ItalicFont = *-Italic, |
| 3389 | + BoldItalicFont = *-BoldItalic |
| 3390 | +] |
| 3391 | +\setmonofont{CMU Typewriter Text} |
| 3392 | +\RequirePackage{unicode-math} |
| 3393 | +\setmathfont{texgyrepagella-math.otf} |
3340 | 3394 | \RequirePackage[ |
3341 | 3395 | top=2.5cm, bottom=2.5cm, |
3342 | 3396 | left=4cm, right=2cm, |
@@ -3451,8 +3505,6 @@ delim_1 "\\hspace*{\\fill}" |
3451 | 3505 | %<cfg|dtx-style>\def\UGR{\href{http://due.hitsz.edu.cn/info/1343/3864.htm} |
3452 | 3506 | %<cfg|dtx-style>{《\hitsz 本科生毕业论文撰写规范》}} |
3453 | 3507 | %<cfg>\def\hitsz@inline@sep{,} |
3454 | | -% \end{macrocode} |
3455 | | -% \begin{macrocode} |
3456 | 3508 | %<*dtx-style> |
3457 | 3509 | \NewDocumentEnvironment{hitszrgu}{o o} |
3458 | 3510 | { \IfNoValueTF{#1}{\PGR,\UGR}{#1}\IfNoValueF{#2}{#2中}% |
|
0 commit comments