I'm struggling with a case of (silently) disappearing hat. It works fine on one computer, but on another I don't see the first accent:

\documentclass[border=3mm,preview]{standalone}

\usepackage[math-style=TeX]{unicode-math}
\setmathfont{xits-math.otf}

\begin{document}
\[
\mathbf{\hat d}, \mathbf{d}, \hat d
\]
\end{document}

enter image description here

I've just upgraded to MacTeX 2017 to see if that would help, but no luck. unicode-math just doesn't seem to like the bold math hat. Is there a good workaround? I should mention that I'm using xetex, and the intended main font would be Source Sans Pro.

share|improve this question
    
Try \symbf instead of \mathbf. – Henri Menke 10 hours ago
    
Or do \setmathfontface\mathbf{xits-bold.otf} and enjoy the misplaced hat. – Henri Menke 10 hours ago
    
actually, both solutions give me a misplaced hat (right and left, respectively). What's going on? – baptiste 9 hours ago
up vote 5 down vote accepted

I'd like to suggest that you do yourself a big favor and download and install the STIX Two text and math fonts. The STIX Two fonts are much nicer and better designed that either the Stix or the XITS fonts.

The following code runs under both XeLaTeX and LuaLaTeX.

enter image description here

\documentclass[border=3mm,preview]{standalone}
\usepackage[math-style=TeX]{unicode-math}
\setmathfont{STIX Two Math}
\begin{document}
\( \mathrm{d}, d, \hat{d}, \symbf{d}, \hat{\symbf{d}}, \symbf{\hat{d}} \)
\end{document}
share|improve this answer
    
thanks! it works well on this example, unfortunately for my longer document I'm getting a dreaded ! Internal error: bad native font flag in map_char_to_glyph'` and I'm not even sure which section is the problem – baptiste 9 hours ago
    
@baptiste - Please try to narrow down where the problem is occurring and then post a representative part of the problematic code. – Mico 9 hours ago
    
I found the issue and solved it; I'd inherited some weird {\hat {\mathbf {\theta }}} from somewhere, and those were the problem. The document compiles now, and looks mostly good. One slight issue is the hat's position on bold theta, \symbf{\hat{\theta}} is a bit off. – baptiste 8 hours ago
    
@baptiste I get no displacement with XITS Math. Unfortunately the STIX Two Math font seems to be plagued by small bugs. – egreg 6 hours ago

You can use the command \boldsymbold for the amsmath package.

\documentclass[12pt,a4paper,oneside,titlepage]{scrartcl}
\usepackage{amsmath}
\begin{document}
$\hat{d}$ 
$\boldsymbol{\hat{d}}$
\end{document}

enter image description here

share|improve this answer
1  
Welcome to TeX.SX! Thanks for taking your time to answer a question. Here you can find some helpful [tips on how to make your answer great](tex.stackexchange.com/help/how-to-answer great) for the future. – Bobyandbob 5 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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