Skip to content

Commit 52accaa

Browse files
authored
Merge pull request #5 from syvshc/fix-newtxmath
Fix newtxmath
2 parents 17fa33d + d70e868 commit 52accaa

File tree

4 files changed

+129
-12
lines changed

4 files changed

+129
-12
lines changed

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
auto
2+
node_modules
3+
dist
4+
.DS_Store
5+
*~
6+
*.aux
7+
*.bak
8+
*.bbl
9+
*.blg
10+
*.dvi
11+
*.glo
12+
*.gls
13+
*.idx
14+
*.ilg
15+
*.ind
16+
*.log
17+
*.out
18+
*.thm
19+
*.toc
20+
*.lof
21+
*.lot
22+
*.loe
23+
*.vrb
24+
*.hd
25+
*.fdb_latexmk
26+
*.fls
27+
*.doc
28+
*.pdf
29+
*.toe
30+
*.xdv
31+
*.zip
32+
/GPATH
33+
/GRTAGS
34+
/GTAGS
35+
/_region_.prv/
36+
/_region_.synctex.gz
37+
/_region_.tex
38+
*.syctex.gz
39+
*.gz
40+
*.cfg
41+
*.cls
42+
*.sty
43+
*.bst
44+
*.ist
45+
*.ins
46+
*.eps
47+
48+
!hitszthesis-*.pdf

dtx-style.sty

100644100755
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,26 @@
2525
%%
2626
\ProvidesPackage{dtx-style}
2727
\RequirePackage{hypdoc}
28-
\RequirePackage[UTF8,scheme=chinese,fontset=windowsnew]{ctex}
29-
\RequirePackage{newpxtext}
30-
\RequirePackage{newpxmath}
28+
\RequirePackage[UTF8,scheme=chinese,fontset=windows]{ctex}
29+
%\RequirePackage{newpxtext}
30+
% 使用 otf 字体来规避 newpxtext 宏包的 bug.
31+
\setmainfont{TeXGyrePagellaX}[
32+
Extension = .otf,
33+
UprightFont = *-Regular,
34+
BoldFont = *-Bold,
35+
ItalicFont = *-Italic,
36+
BoldItalicFont = *-BoldItalic,
37+
]
38+
\setsansfont{IBMPlexSansCondensed}[%
39+
Extension = .otf,
40+
UprightFont = *-Regular,
41+
BoldFont = *-Bold,
42+
ItalicFont = *-Italic,
43+
BoldItalicFont = *-BoldItalic
44+
]
45+
\setmonofont{CMU Typewriter Text}
46+
\RequirePackage{unicode-math}
47+
\setmathfont{texgyrepagella-math.otf}
3148
\RequirePackage[
3249
top=2.5cm, bottom=2.5cm,
3350
left=4cm, right=2cm,
@@ -136,7 +153,7 @@
136153
\def\hitsz{哈尔滨工业大学(深圳)}
137154
\def\PGR{\href{http://hitgs.hit.edu.cn/aa/fd/c3425a109309/page.htm}
138155
{《\hitsz 研究生学位论文撰写规范》}}
139-
\def\UGR{\href{http://www.hitsz.edu.cn/UserFiles/editor/file/20190923/1569224708968004622.doc}
156+
\def\UGR{\href{http://due.hitsz.edu.cn/info/1343/3864.htm}
140157
{《\hitsz 本科生毕业论文撰写规范》}}
141158
\NewDocumentEnvironment{hitszrgu}{o o}
142159
{ \IfNoValueTF{#1}{\PGR,\UGR}{#1}\IfNoValueF{#2}{#2中}%

hitszthesis.dtx

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
%
1717
% \iffalse
1818
%<*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)]
2020
\documentclass{ltxdoc}
2121
\usepackage{dtx-style}
2222

@@ -25,6 +25,25 @@
2525
\RecordChanges
2626

2727
\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
2847
\DocInput{\jobname.dtx}
2948
\end{document}
3049
%</driver>
@@ -937,7 +956,7 @@
937956
%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
938957
%<cls>\ProvidesClass{hitszthesis}
939958
%<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)]
941960
% \end{macrocode}
942961
%
943962
% \subsection{定义选项}
@@ -1245,7 +1264,25 @@
12451264
% 添加数学字体开关
12461265
% \begin{macrocode}
12471266
\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
12491286
\else
12501287
\ifhitsz@mtprotwolite
12511288
\let\Bbbk\relax
@@ -3334,9 +3371,26 @@ delim_1 "\\hspace*{\\fill}"
33343371
%<*dtx-style>
33353372
\ProvidesPackage{dtx-style}
33363373
\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}
33403394
\RequirePackage[
33413395
top=2.5cm, bottom=2.5cm,
33423396
left=4cm, right=2cm,
@@ -3451,8 +3505,6 @@ delim_1 "\\hspace*{\\fill}"
34513505
%<cfg|dtx-style>\def\UGR{\href{http://due.hitsz.edu.cn/info/1343/3864.htm}
34523506
%<cfg|dtx-style>{《\hitsz 本科生毕业论文撰写规范》}}
34533507
%<cfg>\def\hitsz@inline@sep{,}
3454-
% \end{macrocode}
3455-
% \begin{macrocode}
34563508
%<*dtx-style>
34573509
\NewDocumentEnvironment{hitszrgu}{o o}
34583510
{ \IfNoValueTF{#1}{\PGR,\UGR}{#1}\IfNoValueF{#2}{#2中}%

hitszthesis.pdf

25.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)