[Tex/LaTex] How to modify the placement of the prime symbol

fontsmath-modemathspecxetex

Some colleagues and I are writing a series of math notes and the house style (not up to us) is to use the Gotham Book family of fonts. So our math italic font is Gotham Book Italic.

We're noticing that some of the placement of symbols is less than optimal. See for instance the MWE below:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Gotham Book}
\setmathrm{Gotham Book}
\setmathfont(Digits,Latin){Gotham Book}
\begin{document}
\begin{align*}
    f'(x) &= x^2 \\
    f\,'(x) &= x^2 \\
\end{align*}
\end{document}

sample output

In the first line the prime symbol is crashing into the f. Adding a thin space (second line) makes it look almost right, but obviously we don't want to go adding \,s throughout the code.

Is there a way to automatically add space to the f in this font to prevent the crashing?

Best Answer

You're forgetting the proper mathspec way:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Gotham Book}
\setmathrm{Gotham Book}
\setmathfont(Digits,Latin){Gotham Book}
\begin{document}
\begin{align*}
"f'(x) &= x^2 \\
f'(x) &= x^2 \\
f\,'(x) &= x^2
\end{align*}
\end{document}

enter image description here

With the italic font (that I managed to find in the meanwhile):

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Gotham Book}
\setmathrm{Gotham Book}
\setmathfont(Digits,Latin){Gotham Book}

\begin{document}
\begin{align*}
"f'(x) &= x^2 \\
"h'(x) &= x^2 \\
"g'(x) &= x^2
\end{align*}

\end{document}

enter image description here