TransWikia.com

Why mathbf cannot be redefined?

TeX - LaTeX Asked by lygamac on April 15, 2021

I have a tex file as following:

documentclass[]{article}
usepackage{unicode-math}

letmathbfsymbfup
letemphsymbfup
lettextbfsymbfup

% same result with other ways:
%LetLtxMacro{mathbf}{symbfup}
%renewcommand{mathbf}[1]{symbfup{#1}}
%renewcommand{mathbf}{symbfup}

begin{document}

[
1.mathbfOmega 2.emphOmega 3.textbfOmega 
]


end{document}

And the output is:

enter image description here

From the log file it says Missing character: There is no ? in font [lmroman10-bold]:mapping=tex-text;, which is the behavior of the native mathbf (thus I am trying to use symbfup instead of mathbf).

One Answer

The correct way to do this is usepackage[mathbf=sym]{unicode-math}. See section 4.4.2 of the manual.

You do not want to redefine textbf, as this is a LaTeX command that already does something else in both text and math mode, and redefining it this way will cause bold text to break. You similarly do not want to redefine emph. A standard way to get what you want is textnormal{bfseries v}.

If you want to select both bold text and bold math, use bfseriesboldmath. Then load an OpenType math font that comes with a bold version, such as XITS Math, or declare one with setmathfont[version=bold]{Some Font Math Bold}.

To answer the literal question you asked, unicode-math does most of its definitions at the end of the preamble (which makes it more compatible with other packages), so you would need to redefine most of its commands inside AtBeginDocument.

Correct answer by Davislor on April 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP