我正在使用 hvmath,micropress 的专有字体。 这hvmaths
包裹是公开可用的:据我所知,它的目的是用hvmath
字体系列提供的字体替换文本和数学字体。
使用时,使用或 时siunitx
会出现奇怪的结果:显示默认的计算机现代字体而不是字体(注意和之间的区别:令人费解!)。\num
\SI
hvmath
\celsius
\joule
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{hvmaths}
\usepackage{siunitx}
\begin{document}
123, $123$, \num{123}, $\num{123}$. 12°C, $\SI{12}{\celsius}$, 1J, $\SI{1}{\joule}$.
\end{document}
我知道这可能很难重现,因为 hvmath 字体不能免费下载,但我真的很想知道如何解决这个问题。
编辑
我的日志文件包含更多信息。
LaTeX Font Info: Try loading font information for OT1+hvr on input line 7.
(/home/christophe/texmf/tex/latex/hvmaths/ot1hvr.fd
File: ot1hvr.fd 2001/05/18 v1.5 LaTeX HV Roman font definition (OT1 encoding)
)
LaTeX Font Info: Try loading font information for OML+hvm on input line 7.
(/home/christophe/texmf/tex/latex/hvmaths/omlhvm.fd
File: omlhvm.fd 2001/05/18 v1.5 LaTeX HV math font definition (OML encoding)
)
LaTeX Font Info: Try loading font information for OMS+hvsy on input line 7.
(/home/christophe/texmf/tex/latex/hvmaths/omshvsy.fd
File: omshvsy.fd 2001/05/18 v1.5 LaTeX HV math symbol font definition (OMS enco
ding)
)
LaTeX Font Info: Try loading font information for OMX+hvex on input line 7.
(/home/christophe/texmf/tex/latex/hvmaths/omxhvex.fd
File: omxhvex.fd 2001/05/18 v1.5 LaTeX HV math extended symbol font definition
(OMX encoding)
)
\c__siunitx_mathtt_int=\count136
LaTeX Font Info: Try loading font information for TS1+hvr on input line 8.
(/home/christophe/texmf/tex/latex/hvmaths/ts1hvr.fd
File: ts1hvr.fd 2001/05/18 v1.5 LaTeX HV text symbol font definition (TS1 encod
ing)
) [1
{/home/christophe/.texlive2014/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (
./u.aux) )
Here is how much of TeX's memory you used:
10125 strings out of 493107
220530 string characters out of 6134839
212588 words of memory out of 9000000
13529 multiletter control sequences out of 15000+600000
20063 words of font info for 41 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
34i,7n,56p,10384b,784s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/local/texlive/2014/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr
/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb></home
/christophe/texmf/fonts/type1/micropress-inc/hvmaths/hvsy10.pfb></home/christop
he/texmf/fonts/type1/micropress-inc/hvmaths/mphv.pfb>
编辑2(感谢 cfr 的评论)
知道,如果我siunitx
使用该math-rm
选项进行设置,我会得到:
它更好一些但仍然不是我所期望的:最后一个 J(来自 \joule)是斜体。
顺便说一句,这必须与我链接:
\documentclass[convert={size=640}]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{hvmaths}
\usepackage[version=3]{mhchem}
\begin{document}
$\ce{C_{\alpha}}$
\end{document}
因为,用\usepackage{lmodern}
而不是\usepackage{hvmaths}
,我得到:
答案1
好吧,我找到了一种解决方法,但仍然不清楚它为什么有效。
hvmaths.sty
没有定义\mathrm
字母表mathsf
,所以我需要定义它。
\documentclass[varwidth]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{hvmaths}
\DeclareMathAlphabet{\mathrm}{OT1}{hvr}{m}{n}
\DeclareMathAlphabet{\mathsf}{OT1}{hvr}{m}{n}
\usepackage{siunitx}
\begin{document}
OK: $\mathrm{J} = \mathsf{J}$.
\sisetup{math-rm = \mathsf}
\verb+\sisetup{math-rm = \mathsf}+ OK: 123, $123$, \num{123}, $\num{123}$. 12°C, $\SI{12}{\celsius}$, 1J, $\SI{1}{\joule}$.
\sisetup{math-rm = \mathrm}
\verb+\sisetup{math-rm = \mathrm}+ OK: 123, $123$, \num{123}, $\num{123}$. 12°C, $\SI{12}{\celsius}$, 1J, $\SI{1}{\joule}$.
\end{document}
由于某种原因(?),math-rm = \mathrm
必须在之后设置选项\begin{document}
。
\documentclass[varwidth]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{hvmaths}
\DeclareMathAlphabet{\mathrm}{OT1}{hvr}{m}{n}
\usepackage{siunitx}
\sisetup{math-rm = \mathrm}
\begin{document}
\verb+\sisetup{math-rm = \mathrm}+ in preamble NO
123, $123$, \num{123}, $\num{123}$. 12°C, $\SI{12}{\celsius}$, 1J, $\SI{1}{\joule}$.
\end{document}
这里使用了\mathsf
(undefined by ):默认为计算机现代无衬线字体。hvmaths
\documentclass[varwidth]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{hvmaths}
\DeclareMathAlphabet{\mathrm}{OT1}{hvr}{m}{n}
\usepackage{siunitx}
\AtBeginDocument{\sisetup{math-rm = \mathrm}}
\begin{document}
\verb+\sisetup{math-rm = \mathrm}+ after preamble OK
123, $123$, \num{123}, $\num{123}$. 12°C, $\SI{12}{\celsius}$, 1J, $\SI{1}{\joule}$.
\end{document}