I cannot seem to be able to create a prime (') in any custom font. This, for example

\usepackage{unicode-math, polyglossia}
\setmainfont{Times New Roman}
  Hello, I want A-prime: 

gives "Undefined control sequence [ $$A^\prime]" error. I've tried A', A\prime, A^\prime, none works. Without the \setmathfont command, xelatex works fine, outputting the expected A' in the standard CM font. I found this: What is the right way to input prime with Unicode-math (LuaTeX backend) from 3 years ago, but they are concerned about the correct placement of prime, whereas for my example xelatex won't even recognise such command exists. I'd sure be grateful for any pointers.

  • 1
    That font is not a math font.
    – Manuel
    Oct 25, 2014 at 15:20
  • I subset it for Latin letters only. Shouldn't it leave the symbols alone? Oct 25, 2014 at 15:28
  • 1
    You see this even with 'proper' math mode fonts: I suspect it's a unicode-math bug
    – Joseph Wright
    Oct 25, 2014 at 15:33
  • @AlexanderPavlov Say \setmathfont{TeX Gyre Termes Math}, or \setmathfont{texgyretermes-math.otf} if you haven't installed it on your system
    – egreg
    Oct 25, 2014 at 15:41

1 Answer 1


It seems that there are appearing bugs in unicode-math.

Here's a workaround: load the prime from a math font after loading the fonts. By the way, it's necessary to call \setmathfont with the original font after any others to set the correct “fontdimens”.

\setmathfont[range=\mathit/{latin,Latin}]{Gentium Italic}
\setmathfont[range={"2032}]{TeX Gyre Pagella Math}
\setmathfont[range={\int}]{Latin Modern Math}
Hello, I want A-prime: \[ A^\prime \textrm{ or } x' \]

enter image description here

I used TeX Gyre Pagella Math because it looks better in my example, with Latin Modern Math you only need

\setmathfont[range=\mathit/{latin,Latin}]{Gentium Italic}
\setmathfont[range={"2032}]{Latin Modern Math}
  • That does it for me, thank you! Should I try to report it, or is this behaviour by design for symbols missing in current font? Oct 29, 2014 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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