Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctex宏包似乎与STIX宏包冲突? #726

Open
tsiayigong opened this issue Nov 19, 2024 · 2 comments
Open

Ctex宏包似乎与STIX宏包冲突? #726

tsiayigong opened this issue Nov 19, 2024 · 2 comments

Comments

@tsiayigong
Copy link

如题,当使用ctex宏包并在xelatex引擎下编译时,无法得到正确的数学公式,MWE如下:

\documentclass{article}

\usepackage[scheme=plain,UTF8, fontset=none, zhmap=false]{ctex}

\usepackage{stix}
\usepackage{amsmath}

\begin{document}

\begin{align}
   i\hbar \partial_t \psi(\boldsymbol{r},t) = H\psi(\boldsymbol{r},t) \\
      = \left[-\frac{\hbar^2}{2m}\nabla^2+U(\boldsymbol{r})\right]\psi(\boldsymbol{r},t)
\end{align}

\end{document}

其中,不管是否关闭zhmap,得到的结果都不正确:
image
可以看到,此时的中括号的减号都不正确,并且数字也没有变成stix中的字体,但是如果使用pdflatex引擎编译,则能得到正确的结果:
image
请问这是否是一个bug呢?

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Nov 19, 2024

ctex 换成 xeCJK + $\left[ \frac12 \right]$ 就能复现问题,$[ a ]$ 不复现。像是长版括号的映射错了。我不了解字体相关……

% !TeX program = xelatex
\documentclass{article}
\usepackage{xeCJK}

\usepackage{amsmath}
\usepackage{stix2}

\begin{document}
\[
  [\frac12] \quad \left[ \frac12 \right]
\]
\end{document}

image

一些尝试(注意力主要在括号是否正确上,没太关注其他字符)

  • 没用(问题不解决)
    • stix 字体包换成 stix2
    • \PassOptionsToClass{no-math}{fontspec}
    • xeCJK + \xeCJKsetup{xeCJKactive=false}; \usepackage[LoadFandol=false]{xeCJK}
    • ctex + 用 lualatex 编译
  • 有用
    • ctex/xeCJK 后加载 lmodern
    • 加载 unicode-math 并设置 \setmathfont{STIX Two Math}(但这样就不支持 pdflatex 了)
    • luatexja + 用 lualatex 编译

像是 xeCJK 和「ctex + lualatex」的公共部分导致的。

@miaomier
Copy link

  • \PassOptionsToClass{no-math}{fontspec}

应该是 \PassOptionsToPackage{no-math}{fontspec} 就可以,你错写成 \PassOptionsToClass 就没作用了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants