我最近开始使用 LuaLaTeX(多年来一直使用 pdflatex),但似乎在使用这个bm
软件包时遇到了麻烦。例如,当我尝试编译简单文档时:
\documentclass[12pt]{article}
\usepackage{bm}
\begin{document}
I really want to be able to use the ``bm'' bold math symbols,
to reproduce something like
\[\frac{\partial \bm{u}}{\partial t}+\left(\bm{u}\cdot\nabla\right)\bm{u}-
\,\textbf{div}\,\bm{\sigma} = \bm{f}.\]
\end{document}
我收到很多!Invalid math code. \bm@command->\mathchar
类型错误,并且\bm{u}
s 被替换为大写 gammas(但似乎\bm{\sigma}
工作正常)。我尝试\usepackage{unicode-math}
在调用bm
包之前和之后添加,但这似乎把事情搞得一团糟。我确信我只是在这里遗漏了一些简单的东西。
日志文件在这里:
This is LuaTeX, Version beta-0.70.1-2011062107 (rev 4277) (format=lualatex 2011.7.3) 1 JAN 2013 11:41
restricted \write18 enabled.
**bmtest,tex.tex
(./bmtest,tex.tex
LaTeX2e <2009/09/24>
LuaTeX adaptation of babel <v3.8l-luatex-1.4> and hyphenation patterns for engl
ish, dumylang, nohyphenation, loaded.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/bm.sty
Package: bm 2004/02/26 v1.1c Bold Symbol Support (DPC/FMi)
\symboldoperators=\mathgroup4
\symboldletters=\mathgroup5
\symboldsymbols=\mathgroup6
LaTeX Font Info: Redeclaring math alphabet \mathbf on input line 138.
LaTeX Info: Redefining \bm on input line 204.
) (./bmtest,tex.aux)
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 8.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 8.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 8.
! Invalid math code.
\bm@command ->\mathchar 31458421
l.8 \[\frac{\partial \bm{u}}{\partial t}
+\left(\bm{u}\cdot\nabla\right)\bm{u...
I'm going to use 0 instead of that illegal code value.
! Invalid math code.
\bm@command ->\mathchar 31458421
l.8 ...c{\partial \bm{u}}{\partial t}+\left(\bm{u}
\cdot\nabla\right)\bm{u}-\...
I'm going to use 0 instead of that illegal code value.
! Invalid math code.
\bm@command ->\mathchar 31458421
l.8 ...ial t}+\left(\bm{u}\cdot\nabla\right)\bm{u}
-\,\textbf{div}\,\bm{\sigm...
I'm going to use 0 instead of that illegal code value.
! Invalid math code.
\bm@command ->\mathchar 31458406
l.8 ...\bm{u}-\,\textbf{div}\,\bm{\sigma} = \bm{f}
.\]
I'm going to use 0 instead of that illegal code value.
[1
{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./bmtest,tex.aux) )
Here is how much of LuaTeX's memory you used:
337 strings out of 494990
100000,89155 words of node,token memory allocated
266 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 40 glue_spec, 1 write nodes
avail lists: 1:1,2:18,3:23,4:69,5:13,6:106,7:2,9:19,10:6
3942 multiletter control sequences out of 65536+200000
35 fonts using 1387539 bytes
22i,4n,19p,140b,110s stack positions out of 5000i,500n,10000p,200000b,50000s
</usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb><
/usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi12.pfb></
usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmmib10.pfb></
usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></us
r/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on bmtest,tex.pdf (1 page, 43181 bytes).
PDF statistics: 28 PDF objects out of 1000 (max. 8388607)
19 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 131072)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
实际上,在查看了软件包文档之后,我发现如果我使用而不是仅仅使用,bm
它似乎可以正常工作。但这似乎是一种黑客行为——同样,我所做的唯一一件事就是从 pdflatex 更改为 lualatex。\bm{{u}}
\bm{u}
答案1
在 TeX Live 2012 版本(又名 0.70.2)发布之前,LuaTeX 具有\mathcode
输出与数学字符定义方式匹配的功能,并且由于 lua(la)tex 格式使用扩展\Umathcode
原语分配初始数学代码,因此输出是扩展形式,这bm
与它期望的旧的、非扩展的形式不符。
另一方面,XeTeX 输出非扩展形式的\mathcode
值,这些值无论如何分配都是合法的,否则会引发错误,这样做的好处是可以保留旧代码,例如\bm
happy 的代码(只要不使用 Unicode 数学字体),而且由于 LuaTeX 旨在与 XeTeX 在这方面兼容,因此行为已更改为与 XeTeX 相匹配。查看 LuaTeX 邮件列表线提出此问题以获取更多详细信息。