Sjtuthesis: 单位显示问题

Created on 15 Jul 2019  ·  9Comments  ·  Source: sjtug/SJTUThesis


问题描述:
用siunitx包输入单位,当输入的单位带有负的上标的时候,显示都会出错,负号不显示。也就是\per这个命令显示的不对。但是并没有报错。
具体如下:
代码为\si{\kelvin\per\minute\per\square\meter}
显示的却是:
Screen Shot 2019-07-15 at 21 13 29

系统信息:

  • OS版本(带版本号): macOS
  • TeX 发行版(带版本号): MacTeX

日志信息:

oLinux omacOS typquestion

Most helpful comment

试了一下:

\sisetup{
  detect-all,
  text-angstrom        = \ensuremath{\text{\AA}},
  math-angstrom        = \ensuremath{\text{\AA}},
  math-micro           = \ensuremath{\text{\textmu}},
  math-ohm             = \ensuremath{\text{\textohm}},
  group-minimum-digits = 4,
  separate-uncertainty = true,
  inter-unit-product   = \ensuremath{{}\cdot{}},
}
\AtBeginDocument{
  \expandafter\let\csname c__siunitx_minus_tl\endcsname=\textminus}

测试代码:

\def\TEST{hi\ \si{\kelvin\per\square\um\degreeCelsius\per\ohm\angstrom}\ \ang{1;2;3}\ \num{1+2i e10}}
\begin{tabular}{ll}
              &           \TEST \\
  bold        & \bfseries \TEST \\
  italic      & \itshape  \TEST \\
  sans serif  & \sffamily \TEST \\
  typewriter  & \ttfamily \TEST \\
  inline math & $\TEST$         \\
  disp. math  & \fbox{\parbox{10cm}{\[\TEST\]}}
\end{tabular}

image

当然还是全换到 OpenType 最干净了……

All 9 comments

问题描述:
用siunitx包输入单位,当输入的单位带有负的上标的时候,显示都会出错,负号不显示。也就是\per这个命令显示的不对。但是并没有报错。
具体如下:
代码为\si{\kelvin\per\minute\per\square\meter}
显示的却是:
Screen Shot 2019-07-15 at 21 13 29

哦对了,然后在其它文档输入相同的代码,显示的就是对的。
Screen Shot 2019-07-15 at 21 23 19

系统信息:

  • OS版本(带版本号): macOS
  • TeX 发行版(带版本号): MacTeX

日志信息:

感谢反馈,这个问题应该和模版的字体设置相关,我再研究一下。

可以在导言区加上 \sisetup{detect-mode=false}

@AlexaraWu 模版里面当前配置为:

https://github.com/sjtug/SJTUThesis/blob/b34d07ab4a691efd879e0308ff1a2d17dabf85ee/source/sjtuthesis.dtx#L1901-L1906

这里 detect-all 感觉没什么必要吧?

@stone-zeng detect-all 是为了解决 μm 的输出问题,不过现在看来“按下葫芦起了瓢”。说到底原来为了省事直接用了 newtx 字体包,导致现在模版字体编码是 Unicode 和 OT1 或 T1 混用的状态。既然使用的是 XeTeX 引擎,不如统一手动设置为 OpenType 字体好了。

欢迎加入 unicode-math Users Group

@zepinglee 感谢提供参考。

试了一下:

\sisetup{
  detect-all,
  text-angstrom        = \ensuremath{\text{\AA}},
  math-angstrom        = \ensuremath{\text{\AA}},
  math-micro           = \ensuremath{\text{\textmu}},
  math-ohm             = \ensuremath{\text{\textohm}},
  group-minimum-digits = 4,
  separate-uncertainty = true,
  inter-unit-product   = \ensuremath{{}\cdot{}},
}
\AtBeginDocument{
  \expandafter\let\csname c__siunitx_minus_tl\endcsname=\textminus}

测试代码:

\def\TEST{hi\ \si{\kelvin\per\square\um\degreeCelsius\per\ohm\angstrom}\ \ang{1;2;3}\ \num{1+2i e10}}
\begin{tabular}{ll}
              &           \TEST \\
  bold        & \bfseries \TEST \\
  italic      & \itshape  \TEST \\
  sans serif  & \sffamily \TEST \\
  typewriter  & \ttfamily \TEST \\
  inline math & $\TEST$         \\
  disp. math  & \fbox{\parbox{10cm}{\[\TEST\]}}
\end{tabular}

image

当然还是全换到 OpenType 最干净了……

441 因为兼容性问题先坑了,暂时先用 @stone-zeng 提供的代码修一下。

Was this page helpful?
0 / 5 - 0 ratings