[Tex/LaTex] Suddenly, a problem with boldface Greek symbols; bm package doesn’t work

boldfontsmath-modesymbolsxetex

I've added the following packages:

\usepackage{fontspec}
\usepackage{xunicode,xltxtra,url,parskip} 
\usepackage[usenames,dvipsnames]{xcolor} 
\usepackage{hyperref} 
\definecolor{linkcolour}{rgb}{0,0.2,0.6} 
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} 

In addition, I started compiling(?) in XeLaTeX instead of pdfLaTeX.

As a consequence, in the math environment, the boldface (i.e. \mathbf) in combination with Greek letters does not work (whereas the latin letter do work). Just to clarify: I can still compile my code, but the Greek letter have become invisible in the output.

I've tried to use the \bm package to attempt to circumvent this problem, but it spits out the following error:

! Undefined control sequence.
\Call@AtVeryEndDocument ...cumentHook \@undefined 
                                              \global \let \Call@AtVeryE...

Does anybody know how to fix this problem?

Best Answer

When you load fontspec also the font for math upright letters is changed to use the default text font. The Greek letters in this font are not where LaTeX expects them to be: with the standard definition, \Phi points to slot 0x08, while the uppercase Phi in Unicode is at U+03A6.

The command \mathbf, in standard LaTeX, only works with Latin letters and uppercase Greek. You can revert to the standard behavior by loading

\usepackage[no-math]{fontspec}

that will use the standard Computer Modern font for upright math characters. But there's no point in not doing the big step and load

\usepackage{unicode-math}

but you need \symbf rather than \mathbf (also for Latin letters).

See the following example:

\documentclass{article}
\usepackage{unicode-math}
\begin{document}

$\symbf{\Phi}+\symbf{\alpha}$

$\Phi+\alpha$
\end{document}

that produces

enter image description here

If you don't want to do the big step, you still can get \mathbf to work with uppercase Greek; just teach XeLaTeX where to go and find the uppercase Greek letters.

\documentclass{article}
\usepackage{fontspec}

\AtBeginDocument{
  \Umathchardef\Gamma   = 7 0 "0393
  \Umathchardef\Delta   = 7 0 "0394
  \Umathchardef\Theta   = 7 0 "0398
  \Umathchardef\Lambda  = 7 0 "039B
  \Umathchardef\Xi      = 7 0 "039E
  \Umathchardef\Pi      = 7 0 "03A0
  \Umathchardef\Sigma   = 7 0 "03A3
  \Umathchardef\Upsilon = 7 0 "03A5
  \Umathchardef\Phi     = 7 0 "03A6
  \Umathchardef\Psi     = 7 0 "03A8
  \Umathchardef\Omega   = 7 0 "03A9
}

\begin{document}
$\Gamma+\Delta+\Theta+\Lambda+\Xi+\Pi+\Sigma+
 \Upsilon+\Phi+\Psi+\Omega$

$\mathbf{\Gamma}+\mathbf{\Delta}+\mathbf{\Theta}+\mathbf{\Lambda}+
 \mathbf{\Xi}+\mathbf{\Pi}+\mathbf{\Sigma}+\mathbf{\Upsilon}+
 \mathbf{\Phi}+\mathbf{\Psi}+\mathbf{\Omega}$

\end{document}

enter image description here


Although you can find somewhere that xunicode and xltxtra are recommended with XeLaTeX, the information is outdated and they should not be loaded. Only xltxtra can, in the unusual situation that you really need the features it provides.