# How do I modify the placement of the prime symbol?

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}


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?

• Define your own prime \newcommand\myprime{\,'} Feb 6 '15 at 18:35

## 2 Answers

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}


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}


• Ah, no I didn't forget; I've never known that syntax! I had trouble finding it in mathspec's documentation, too. But there it is, in the code comments: put the " before a character, e.g $􏰐"f$􏰐, and the character is printed with kerns on either side. Feb 6 '15 at 18:45
• @egreg -- matthew's visual shows the italic "f"; yours is upright. i think something has been omitted from matthew's code. one could remedy the spacing by creating a virtual font for the gotham book italic, with "proper" italic corrections, but it would be a real pain. Feb 6 '15 at 19:26
• @barbarabeeton I only found the upright version. Now it's with italics. Feb 6 '15 at 20:33

Use ^{\prime}, e.g.

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\begin{document}
\begin{align*}
&f^{\prime}(x) = x^2\\
&f^{\prime \prime}(x) = 2 x
\end{align*}
\end{document}


• Typing $f'(x)$ or $f^{\prime}(x)$ produces exactly the same result. Feb 7 '15 at 10:20