tuna / thuthesis

LaTeX Thesis Template for Tsinghua University
https://www.ctan.org/pkg/thuthesis
LaTeX Project Public License v1.3c
4.52k stars 1.07k forks source link

\mathbb not available when using newcm as math-font #940

Closed YijunYuan closed 5 months ago

YijunYuan commented 5 months ago

提交前检查

系统

Ubuntu 23.10 on Windows 10 x86_64, 5.15.146.1-microsoft-standard-WSL2

TeX 发行版

TeXLive 2023

TeX 编译器

XeLaTeX

版本

7.5.0

学位类型

doctor

问题描述

使用newcm作为math-font时,使用\mathbb字体显示Undefined control sequence.

复现代码

\documentclass[math-font=newcm]{thuthesis}
\begin{document}
\maketitle
\frontmatter
\mainmatter
$\mathbb{R}$
\backmatter
\end{document}

编译日志

......

LaTeX Font Warning: Font shape `OMX/cmex/m/n' in size <16.06> not available
(Font)              size <17.28> substituted on input line 3.

LaTeX Font Warning: Font shape `OMX/cmex/m/n' in size <10.53937> not available
(Font)              size <10.95> substituted on input line 3.

[1] [2]

LaTeX Font Warning: Font shape `OMX/cmex/m/n' in size <15.05624> not available
(Font)              size <14.4> substituted on input line 3.

[3] [4]
! Undefined control sequence.
<recently read> \mathbb 

l.6 $\mathbb
            {R}$

其他信息

newcm换为lm有同样报错。

YijunYuan commented 5 months ago

临时解决方案: 在文件开头添加

\RequirePackage{amssymb}

强行使用amssymb。但这么干会有什么副作用很难说。

Harry-Chen commented 5 months ago
\documentclass[math-font=newcm]{thuthesis}
\begin{document}
\maketitle
\frontmatter
\mainmatter
$\mathbb{R}$
\backmatter
\end{document}

\RequirePackage 并非给文档作者使用的,直接 \usepackage{amssymb} 即可,这是预期的用法,也没有什么副作用。也可见 https://tex.stackexchange.com/questions/360607/unicode-math-but-ordinary-blackboard-bold

YijunYuan commented 5 months ago
\documentclass[math-font=newcm]{thuthesis}
\begin{document}
\maketitle
\frontmatter
\mainmatter
$\mathbb{R}$
\backmatter
\end{document}

\RequirePackage 并非给文档作者使用的,直接 \usepackage{amssymb} 即可,这是预期的用法,也没有什么副作用。也可见 tex.stackexchange.com/questions/360607/unicode-math-but-ordinary-blackboard-bold

我想说的是thuthesis的文档里已经明确说明unicode-mathamssymb不兼容 https://github.com/tuna/thuthesis/blob/9307b229f60764b2c26d6c58d4580576692c17e4/thuthesis.dtx#L883 https://github.com/tuna/thuthesis/blob/9307b229f60764b2c26d6c58d4580576692c17e4/thuthesis.dtx#L884 。所以您这里说的

直接 \usepackage{amssymb} 即可,这是预期的用法

thuthesis的文档不是很一致。

Harry-Chen commented 5 months ago

我想说的是thuthesis的文档里已经明确说明unicode-mathamssymb不兼容

这里的“不兼容”要看具体情况,并不是说两个库同时使用就一定会导致严重的问题。据我所知,unicode-math 对于数学排版的处理会破坏 amssymb 的部分字体选择等功能。但如果只是用 \mathbb 引入一些用来集合标记的字体,并没有太大的问题。

此外,引用代码不需要一行一行引用,可以引用多行。

zepinglee commented 5 months ago

目前 math-font 只能用在导言区不能用在 \documentclass 的参数。下面的例子可以 work。

\documentclass{thuthesis}
\thusetup{math-font = newcm}
\begin{document}
$\mathbb{R}$
\end{document}
Screenshot 2024-04-01 at 09 35 08