I've done some intrusive changes using the unicode-math
package to still use a font of my liking, a font which is not supported by TeX
out-of-the-box. Passing more options to unicode-math
causes it to undefine more and more features, in comparison to just setting the math font and letting unicode-math
do the work. That doesn't seem to be an option here, since I still want to use e.g. greek letters and so on, which are not directly supported by the font I want.
I'm now at a stage where I wish to use e.g. the \vec
and \hat
commands. To obtain the correct unicode
range, I've used \show\vec
and \show\hat
in my document, from which I yielded the unicode-math
related font command
\setmathfont[range={"020D7,"00302}]{XITS}
The resulting math expressions now look a little like this:
Needless to say, the result is not exactly as intended: both the \vec
as well as the \hat
command produce the incorrect horizontal alignment compared to their argument. Take for instance \hat A
. The \hat
is way too much to the left compared to the A
. The same issue goes for the \vec
's at the top.
What options do I have to adjust this horizontal spacing "internally"? I've intentionally circumvented redefining \vec
& \hat
previously. Anyway, I know this issue is related to my font but it would be nice to have sort of a "universal" answer (if there is one), to just place these characters 5pt
to the right.
Here's an MWE to play with, with the same text as in the screenshot. Here I've imported the full XITS
font for math purposes, which shows a similar issue: here, the \hat
is aligned too far to the right compared to the A
in the displaymath expression.
Lastly, solutions that are applicable to many cases are a pro, but are less than mandatory. If only \hat
and \vec
are covered in the solution I'm fine with that.
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{unicode-math}
\setmathfont{XITS}
\begin{document}
In onze benadering stellen we dat er alleen een $\vec B$-veld is langs de $z$ as, waaruit een magnetisch veld volgt in de $z$-as van $\vec B_z=\left(\delta_xA_y-\delta_yA_x\right)\vec z$.
Omdat er eikenvariantie geldt, kunnen we al naar gelang bij onze elektrische potentiaal een scalar optellen zonder dat er iets verandert\. Daarom maken we de volgende substituties:
\begin{align}
\hat A&\rightarrow \hat A=\hat A+\nabla\psi\\
\phi&\rightarrow \phi=\phi-\frac1c\frac {\partial\psi}{\partial t}
\end{align}
Om hier echt iets mee te kunnen hebben we nog \'e\'en stap nodig. Normaal gesproken werken we in de Coulomb-eik met $\nabla\cdot\vec A=0$. We kunnen echter kiezen om in de Landau-eik te werken waarin geldt dat $\vec A=B\vec x\overline y$.
\end{document}
\setmainfont{XITS Math}