4

I would like to use accents on bold characters in math equations with the Utopia font. It appears that the accent is not properly shifted to the left when using \hat{\mathbf{x}} for example. Using \mathbf{\hat{x}} does not give good results either.

Here is the MWE:

\documentclass{article}

\usepackage{fourier-otf}

\begin{document}

\begin{align*}
    X \quad \hat{X} &\qquad x \quad \hat{x} \\
    \mathbf{X} \quad \hat{\mathbf{X}} &\qquad \mathbf{x} \quad \hat{\mathbf{x}} \\
    \mathbf{X} \quad \mathbf{\hat{X}} &\qquad \mathbf{x} \quad \mathbf{\hat{x}}
\end{align*}

\end{document}

and the result that I get:

enter image description here

A similar issue was reported here with the STIX2 font. The problem was related to the version of the font used but I don't know if this could be the issue here. According to tlmgr, the version of the fourier package is 54090 (2.2).

I can get properly aligned accents if I load fourier instead of fourier-otf, but this results in many other issues in my text related to font encoding.

Is there a simple way to make the accents work with bold maths?

1
  • 1
    I don't think that the earlier posting to which you provided a link has much bearing on the issue caused by combining \mathbf with accenting commands such as \hat and \tilde.
    – Mico
    Commented Aug 7, 2020 at 21:56

1 Answer 1

6

You asked,

Is there a simple way to make the accents work with bold maths?

Short answer: Yes. :-)

Slightly longer answer: Since you use Lua(La)TeX and the unicide-math package, simply replace all instances of \mathbf with \symbf.

enter image description here

Please see sections 3.1, "New Commands", and 4.4, "Legacy 'maths' alphabet commands", of the user guide of the unicode-math package for more information on the differences between \mathbf and \symbf (as well as \mathit vs. \symit, \mathup vs. \symup, \mathrm vs. \symrm, and \mathsf and \symsf).

\documentclass{article}
\usepackage{fourier-otf}
\begin{document}
\begin{align*}
X \quad \hat{X} &\qquad x \quad \hat{x} \\
\symbf{X} \quad \hat{\symbf{X}} &\qquad \symbf{x} \quad \hat{\symbf{x}} \\
\symbf{X} \quad \symbf{\hat{X}} &\qquad \symbf{x} \quad \symbf{\hat{x}}
\end{align*}
\end{document}
4
  • \symbf does not work in jupyter notebooks; though after exporting with pdflatex the hat is shown properly. Commented Jul 5, 2023 at 20:06
  • @Friedrich--СлаваУкраїні - Thanks. I must confess that I'm not familiar with Project Jupyter. Does it uses TeX/LaTeX or, rather, Mathjaxx, as the underlying rendering engine?
    – Mico
    Commented Jul 5, 2023 at 20:13
  • 1
    Jupyter seems to use MathJax. Commented Jul 5, 2023 at 20:18
  • 2
    @Friedrich--СлаваУкраїні - That would explain why code that requires LuaLaTeX doesn't run properly.
    – Mico
    Commented Jul 5, 2023 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .