I'm using unicode-math
(with XeLaTeX) to set my text and math fonts. However, using Garamond-math
as a math font, I see the \prime
symbol is too close to the letter:
I am trying to redefine the \prime
command, and if possible I would like to remap '
in math mode so that it gives the correct spacing. However, the "usual" solution to redefine \prime
, that is (MWE)
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Garamond-Math.otf}[StylisticSet={5,7,9}]
\let\originalprime\prime
\def\prime{\mkern3mu\originalprime\mkern-3}
\begin{document}
$f'(x)$
\end{document}
but this solution does not seem to work in this context. I also tried
\usepackage{newunicodechar}
\AtBeginDocument{\newunicodechar{′}{\mkern3mu\prime\mkern-3u}}
but again it had no effect.
Best Answer
In
unicode-math
the command\prime
is defined in terms of an internal function, which is used whenf'(x)
is processed. So redefining\prime
does nothing, unless you do use it explicitly.There is no interface for modifying the behavior, unfortunately. But the following works with the current version of
unicode-math
. However, due to accessing private functions, this is not guaranteed to remain stable in future releases.