sjtug / SJTUThesis

上海交通大学 LaTeX 论文模板 | Shanghai Jiao Tong University LaTeX Thesis Template
Apache License 2.0
3.29k stars 787 forks source link

feat: v1.1.0 develop #570

Closed AlexaraWu closed 3 years ago

AlexaraWu commented 3 years ago

根据个人实际使用的情况以及同学反馈,使用 unicode-math 的效果并不理想,默认使用 unicode-math 的做法还是有点激进。

最近稍微了解了一下 NFSS,感觉正文字体使用 OpenType,数学字体使用 Type 1 的效果好像还不错。

重写了 `latinfontset' 的实现,采用定义文件的方式载入字体设置,可以根据需要自行编写字体定义文件。

新增文档选项 unimath,选择是否偏好使用 unicode-math

欢迎测试和反馈。

zepinglee commented 3 years ago

根据个人实际使用的情况以及同学反馈,使用 unicode-math 的效果并不理想,默认使用 unicode-math 的做法还是有点激进。

为啥?有没有相关的讨论?

AlexaraWu commented 3 years ago

FYI: #555

AlexaraWu commented 3 years ago

我个人不能接受的主要是 XITS 的巨算符太粗了,\sum 看起来像是小字号的 \Sigma 直接放大了一样。还有其他一些说不上来的 违和感,换 newtxmath 就感觉好很多。

zepinglee commented 3 years ago

FYI: #555

感觉还是看学校的要求吧。USTC 要求用 Times New Roman,而且对数学符号的格式作了非常详细的规定(国标样式)。THU 也要求 Times New Roman,而且一些审查老师甚至连 newtx 的西文字体都不给通过,但是对数学符号的要求语焉不详。所以在正文字体必须用 opentype 的情况下,数学字体也用 opentype 更容易些。我还设置了中文模板默认国标样式,英文模板使用 TeX style,也允许用户切换。

我感觉容易出问题的情况是,西文字体和数学符号混着使用 opentype 和 type 1 字体,比如西文字体用 fontspec 设置 Times,数学字体又用 newtxmath。你们学校要求似乎比较少,而且也没要求国标样式的数学符号,可能让用户自行选择最合适吧。

zepinglee commented 3 years ago

我个人不能接受的主要是 XITS 的巨算符太粗了,\sum 看起来像是小字号的 \Sigma 直接放大了一样。还有其他一些说不上来的 违和感,换 newtxmath 就感觉好很多。

有同感,而且积分号的字形也不如 newtx 的美观。

另外还有 STIX Two Math 的小写希腊字母,跟它的拉丁字母字形很不一致,也是很多人不太容易接受,但是设计师说是故意这样设计的。

AlexaraWu commented 3 years ago

我现在是这样设计的,可以通过 unimath 选项来选择是否偏好使用 unicode-math,具体搭配尽量保持同样风格。

\documentclass[latinfontset=termes, unimath=false]{sjtuthesis}
% 目前的默认设置,正文使用 OpenType 的 TeX Gyre 字体,数学使用 newtxmath

\documentclass[latinfontset=termes, unimath=true]{sjtuthesis}
% 正文使用 OpenType 的 TeX Gyre 字体,数学使用 TeX Gyre Termes Math

\documentclass[latinfontset=times, unimath=false]{sjtuthesis}
% 正文使用 Times New Roman,数学使用 newtxmath

\documentclass[latinfontset=times, unimath=true]{sjtuthesis}
% 正文使用 Times New Roman,数学使用 XITS Math

\documentclass[latinfontset=xits]{sjtuthesis}
% XITS + Source 系列,unimath 选项失效,因为 XITS Math 只有 OpenType 格式
AlexaraWu commented 3 years ago

对了,我这个设置 unimath=false 时数学环境中 operators 并不使用正文字体。

555 的需求就可以这样解决

\documentclass[latinfontset=lm]{sjtuthesis}

\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}[Scale = MatchLowercase]

Screen Shot 2021-01-21 at 19 03 41

AlexaraWu commented 3 years ago

更新一下,拆分 latinfontset 选项为 textfontmathfont。并为所有的 OpenType 数学字体显式配置对应的 \mathrm\mathsf\mathtt 字体。正文环境字体和数学环境字体可以通过对应选项分别手动设置,彼此相互独立,可以自由搭配。

zepinglee commented 3 years ago

newtxmath 的配置不需要 upgreek,加了这个反而会有问题。比如 96c06b6 的代码:

\documentclass[type=master,mathfont=termes]{sjtuthesis}
\input{sjtusetup}
\begin{document}
Ω $\Omega$ \si{\ohm}
\end{document}
Screen Shot 2021-02-27 at 02 12 06

注释掉 https://github.com/sjtug/SJTUThesis/blob/96c06b628680984a47cee78067d2827e8e8b330f/texmf/tex/latex/sjtuthesis/fd/sjtu-math-font-termes.def#L52 后才正常。

Screen Shot 2021-02-27 at 02 15 28

另外 amssymb 似乎也有些多余,但没什么影响。

AlexaraWu commented 3 years ago

调查了一下,如果在载入 textcompupgreek 的情况下,siunitx 会优先从这两个包中取用符号。

可以使用 siunitx 选项 redefine-symbols 来控制这个行为:

\sisetup{redefine-symbols = false}

加入 upgreekamssymb 这两个包的目的主要是保证代码在不同字体模式下的兼容性。这些符号类的宏包本质上是用是的各自宏包内的定制字体,不受外部字体设置的影响。

zepinglee commented 3 years ago

加入 upgreekamssymb 这两个包的目的主要是保证代码在不同字体模式下的兼容性。这些符号类的宏包本质上是用是的各自宏包内的定制字体,不受外部字体设置的影响。

upgreekamssymb 提供的符号在 newtx 中都有,感觉更容易造成冲突。

AlexaraWu commented 3 years ago

upgreekamssymb 提供的符号在 newtx 中都有,感觉更容易造成冲突。

冲突倒不会,newtx 放在 upgreekamssymb 之后载入就是确保最后用的是 newtx 的版本。

不过如果 newtx 中已经提供了 upgreekamssymb 的所有符号的话,这里确实是不必要的。这个我不太了解,有空比对一下。

AlexaraWu commented 3 years ago

newtxstix2 确实提供了 amssymb 中几乎所有的符号,但有一些细微的差别:newtx 没有提供 \yenstix2 没有提供 \ntriangleleft\ntriangleleft,而是提供了 \nvartriangleleft\nvartriangleleft

newtx 也包含了 upgreek 中的所有符号,但是对于直立体大写希腊字母的命名方式有所不同。newtxunicode-math 一样是以 \upDelta 的方式命名,而 upgreek 中是 \Updelta

zepinglee commented 3 years ago

分析得好细致。

我个人认为,stix2 没必要使用 Type 1 版本,从作者地态度来看,只是为了提供兼容性支持,并不打算后续得更新。

upgreek 的文档说是故意设计成 \Updelta 的。但是它的字形默认取自 Euler,跟 newtx 或者 cm 其实很不能搭配(参考 https://www.zhihu.com/column/p/19754584),更应该去掉防止有人误用。另外你的 \RequirePackage[upint]{newtxmath} 没有 slantedGreek 参数,大写希腊字母默认就是正体的,所以这些 \up*/\Up* 命令也不重要。

AlexaraWu commented 3 years ago

2021-02-28 更新

感谢 @zepinglee 的建议!

  1. 移除了 Type 1 版 的 stix2,并适配 OpenType 版本的新文件名;
  2. newtxnewpx 的配置中不再加载 amssymbupgreek
  3. upgreek 列为 unicode-math 冲突宏包;
zepinglee commented 3 years ago

刚发现 stix2math 的文件名改了……简直坑

AlexaraWu commented 3 years ago

2021-05-03 更新

  1. 更新字体设置,新增 newcm
  2. 初步支持 LuaLaTeX。
AlexaraWu commented 3 years ago

1.65 版的 newtx 字体包有一个小 bug 导致 CI 不通过。已向 newtx 的维护者邮件报告了。

skyzh commented 3 years ago

看起来可以成功编译了 🎉🎉

zepinglee commented 3 years ago

1.65 版的 newtx 字体包有一个小 bug 导致 CI 不通过。已向 newtx 的维护者邮件报告了。

应该是 newtxmath\ifntx@sl 的定义到了 newtxtext 中 吧?

AlexaraWu commented 3 years ago

应该是 newtxmath\ifntx@sl 的定义到了 newtxtext 中 吧?

几个 fd 文件中的 \newif\ifntx@sl 错写成了 \newif\ntx@sl,1.651 版已经改过来了。

AlexaraWu commented 3 years ago

仔细看了一下《撰写规范》,发现只有宋体有要求加黑的,所以把所有黑体的粗体去掉了。

skyzh commented 3 years ago

MiKTeX still keeps 1.65 of https://miktex.org/packages/newtx, and I think it's time to drop support for now.

AlexaraWu commented 3 years ago

更新了新版一页式的原创性声明及使用授权书,废弃了 \originalitypage 命令。

同时提供了新旧版授权书的 PDF 版本。如需要使用旧版授权书,可以直接插入 PDF。

\copyrightpage[scans/sample-copyright-old.pdf]
skyzh commented 3 years ago

随手翻了一下 ustc 的 issue https://github.com/ustctug/ustcthesis/issues/253

AutoFakeBold 似乎会导致一些奇怪的问题(

AlexaraWu commented 3 years ago

字体选项重命名为 text-fontmath-fontcjk-font

AlexaraWu commented 3 years ago

MiKTeX still keeps 1.65 of https://miktex.org/packages/newtx, and I think it's time to drop support for now.

29 号已经更新到 1.653 了(

skyzh commented 3 years ago

看起来可以合并了,稍后还需要更新一下 readme 去掉 develop 分支相关的信息(

skyzh commented 3 years ago

直接 rebase and merge 到 master?

skyzh commented 3 years ago

ChangeLog

可以编辑这个 comment 添加其他 changelog

AlexaraWu commented 3 years ago

说实话 dirtree 这个例子我想删了,一点都不好看。

skyzh commented 3 years ago

我觉得可以改成黑白的,并且放进附录(

skyzh commented 3 years ago

develop 分支应该可以移除了。之后 master 分支可以用来维护最新测试版,稳定版通过 tag 的方式发布。刚刚对 readme 也相应做了更新(