13

I've updated my latex packages yesterday and have now issues with lualatex. One problem arising for me now is, that lualatex does not print bold characters using the bm package.

When I compile the following MWE with pdflatex everything looks okay, but for lualatex it doesn't:

\documentclass{article}
\usepackage{bm}
\begin{document}
%
Bold $\bm{E}$
\\
Normal $E$
%
\end{document}

Output using pdflatex

enter image description here

using lualatex

enter image description here

Also trying to fall back to an earlier version of lualatex by using \RequirePackage{luatex85} does not work for me.

When having a look at the log file, there are the suspicious messages

LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line 142.
LaTeX Info: Redefining \bm on input line 208.
[...]
Missing character: There is no х (U+0445) in font cmmi10!

Can anyone tell me, what is going on here and what I need to do to solve this problem, since I am quite sure lualatex and bm worked before?

  • 1
    \bm tries to produce the Unicode character U+0445 instead of \mathchar30021. It should work if you load unicode-math. Apart from that, I consider this a regression. – Henri Menke Jun 15 '16 at 12:00
  • 3
    lualatex is increasingly incompatible with tex so this sort of thing is more or less expected. Although that is I think older change not the luatex8x-9x changes that the luatex85 package addresses. I had some version of bm working for a test release of luatex at one point last year but then the mathcode handling changed again (it changed several times in development:-) I can probably update bm now texlive 2016 is stable (but with luatex you should probably be using unicode-math and bm will not work with that) – David Carlisle Jun 15 '16 at 12:00
  • @HenriMenke a bug in what? if you use a program written for tex with a system that takes a similar input syntax but entirely different behaviour and find the program does not work, is that a bug in the program, or user error? – David Carlisle Jun 15 '16 at 12:01
  • @DavidCarlisle Sorry :( I changed »bug« into »regression«. bm is a great package! – Henri Menke Jun 15 '16 at 12:03
  • @DavidCarlisle since I'm nearly finished with my thesis and have a submission date, changing all over to unicode-math is actually not an option. :-/ – JMP Jun 15 '16 at 17:06
13

UPDATE

The patch below has been incorporated into the distributed bm.sty 2016/07/07 v1.2b


Here is an update for bm in luatex using classic math font setup. It does not do the right thing for opentype math fonts with unicode-math (where it is not always clear what the right thing should be as most such setups do not include a bold font)

enter image description here

\documentclass{article}
\usepackage{bm}

\makeatletter
\def\bm@test@token#1{%
  \let\bm@next\@empty
  \ifx#1\@@end
  \else\ifx#1\mathchoice
    \let\bm@next\bm@mathchoice
  \else\ifx#1\mathchar
    \afterassignment\bm@mathchar\count@
  \else\ifx#1\mathaccent
    \afterassignment\bm@mathaccent\count@
  \else\ifx#1\delimiter
    \afterassignment\bm@delimiter\count@
  \else\ifx#1\radical
    \afterassignment\bm@radical\count@
  \else\ifx#1\mkern
    \bm@register#1{\muskip\z@}%
  \else\ifx#1\kern
    \bm@register#1\skip@
  \else\ifx#1\penalty
    \bm@register#1\count@
  \else\ifx#1\unvcopy
    \let\bm@next\bm@add
  \else\ifcat\noexpand#1\relax
    \xdef\meaning@{\meaning#1}%
    \expandafter\bm@mchar@test\meaning@""""\@nil#1%
  \else\ifcat.\ifcat a#1.\else#1\fi
    \count@\mathcode`#1\relax
    \ifnum\count@=\mathcode`\'%
      \begingroup\uccode`\~`#1\uppercase{\endgroup
        \def\bm@next{\bm@expand~}}%
    \else
      \ifx\bm@previous\left
        \count@\delcode`#1\relax
        \bm@delimiter
      \else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \ifnum\count@>"8000
\Umathcharnumdef\@tempa\count@
\xdef\meaning@{\meaning\@tempa}%
\expandafter\bm@mchar@test\meaning@""""\@nil\@tempa
\else
        \bm@mathchar
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      \fi
    \fi
  \else
    \bm@add{#1}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \bm@next}
\makeatother


\begin{document}
%
Bold $\bm{E\left(\frac{A}{B}\right)}$
\\
Normal $E\left(\frac{A}{B}\right)$
%
\end{document}
5

[This is not a solution but a workaround]

You say, that there is an upcoming deadline and there might be no fix available until then. Here is a workaround, which requires the amsmath package (which you most probably use). It defines \bm to use the \boldsymbol macro from amsbsy (loaded automatically by amsmath). Keep in mind that there are certain drawbacks compared to bm, but at least the symbols show up.

\documentclass{article}
\usepackage{amsmath}
\def\bm{\boldsymbol}
\begin{document}
\luatexbanner

Bold $\bm{E}$

Normal $E$
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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