1

I can't get bold math with packages unicode-math and physics, here is mwe

\documentclass{article}
\usepackage{physics}
\usepackage{unicode-math}
\usepackage{amsmath}
\begin{document}
    $ a, \vb*{a}, \symbfit{a} $ 
\end{document}

I got

enter image description here

the second a didn't turn bold. How to fix it?

1

I found that in physics package, it defines \vb as

% Vector notation
\DeclareDocumentCommand\vectorbold{ s m }{\IfBooleanTF{#1}{\boldsymbol{#2}}{\mathbf{#2}}} % Vector bold [star for Greek and italic Roman]
\DeclareDocumentCommand\vb{}{\vectorbold} % Shorthand for \vectorbold

so I can redefine the \vectorbold command like this

\documentclass{article}
\usepackage{physics}
\usepackage{unicode-math}
\usepackage{amsmath}
\DeclareDocumentCommand\vectorbold{ s m }{\IfBooleanTF{#1}{\symbfit{#2}}{\symbf{#2}}} % Vector bold [star for Greek and italic Roman]
\begin{document}
    $ a, \vb*{a}, \vb{a}, \symbfit{a} $ 
\end{document}

enter image description here

Or I can use \symbfit instead of \boldsymbol and \symbf instead of \mathbf to reach the demand

\documentclass{article}
\usepackage{physics}
\usepackage{unicode-math}
\usepackage{amsmath}
\let\boldsymbol\symbfit
\let\mathbf\symbf
\begin{document}
    $ a, \vb*{a}, \vb{a}, \symbfit{a} $ 
\end{document}

enter image description here

I want to know is there some bad influence in these two methods?


I found some bad influence for redefining \mathbf and \boldsymbol, When I use \grad=\boldsymbol\nabla in physics package. which should give an upright, bold, nabla symbol. However \symbfit makes it italic,

\documentclass{article}
\usepackage{physics}
\usepackage{unicode-math}
\usepackage{amsmath}
\let\boldsymbol\symbfit
\let\mathbf\symbf
\begin{document}
    $ \nabla, \grad, \symbf{\nabla} $ 
\end{document}

I got

enter image description here

4
  • Just beat me to it. I would recommend using the more semantic markup. It will also simplify re-using your source in PDFTeX if you ever need to.
    – Davislor
    Aug 8 '21 at 4:47
  • @Davislor sorry, I'm not an english native speaker. I don't understand what you mean. Could you please explain it a little bit? :(
    – Syvshc
    Aug 8 '21 at 5:27
  • Pardon. I mean, I personally prefer a command such as \vectorsym for two reasons. First, it makes it easier to change the style of your vectors if, for example, you want to use an arrow instead of a bold letter. Second, it makes it easier to change from unicode-math and physics to other packages, such as if you have to copy your equation into a document compiled with PDFTeX.
    – Davislor
    Aug 8 '21 at 6:12
  • @Davislor Thanks for your explaination, I understand what you mean now
    – Syvshc
    Aug 8 '21 at 6:34

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.