Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I recently started using LuaLaTeX (after years of just pdflatex) and I seem to be having trouble with the bm package. For example, when I try to compile the simple document:

\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}

I get lots of !Invalid math code. \bm@command->\mathchar type errors and the \bm{u}s are replaced with uppercase gammas (but the \bm{\sigma} seems to work just fine). I tried adding \usepackage{unicode-math} both before and after the call to the bm package, but that seems to mess things up quite a bit. I'm sure I'm just missing something simple here.

Log file is here:

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)

Actually, after looking at the bm package documentation, it seems that it works fine if I use \bm{{u}} instead of just \bm{u}. But this seems like a hack - again, the only thing I did was change from pdflatex to lualatex.

share|improve this question
3  
Welcome to TeX.sx! Your example 'works for me': could we see the .log file? –  Joseph Wright Jan 1 '13 at 16:33
    
Works for me too. Waiting for .logs. –  m0nhawk Jan 1 '13 at 16:37
    
Ok, still learning the proper way to post on stackexchange. Whole log file will be inserted above. –  user23849 Jan 1 '13 at 16:42
1  
Looks like you are using texlive 2011. it might be a good idea to upgrade to texlive 2012. As the others here I have no problem compiling your code using LuaTeX, Version beta-0.70.2-2012101900 (TeX Live 2012TeX Live 2012) –  ArTourter Jan 1 '13 at 16:51
1  
There were some bad interaction between bm in LuaTeX that has been fixed in TeX Live 2012 IIRC. –  Khaled Hosny Jan 1 '13 at 17:27

1 Answer 1

Prior to TeX Live 2012 release (AKA 0.70.2), LuaTeX had the feature that \mathcode output matches the way the math character was defined and since lua(la)tex format assigns initial math codes using the extended \Umathcode primitive, the output was in the extended form, which broke bm as it was expecting the old, non extended, form.

XeTeX, on the other hand, was outputting non extended form with \mathcode for values that is legal to it irrespective how they were assigned and raising an error otherwise, which had the benefit of keeping old code such as that of \bm happy (as long as one does not use Unicode math fonts), and since LuaTeX aims to be compatible with XeTeX in this area, the behaviour got changed to match that of XeTeX. Check the LuaTeX mailing list thread where this issue was raised for more details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.