I cannot seem to be able to create a prime (') in any custom font. This, for example
\documentclass{article}
\usepackage{unicode-math, polyglossia}
\setmainfont{Times New Roman}
\setmathfont[range=\mathit/{latin,Latin}]{timesi.ttf}
\begin{document}
Hello, I want A-prime:
$$A^\prime.$$
\end{document}
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.
Best Answer
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”.I used TeX Gyre Pagella Math because it looks better in my example, with Latin Modern Math you only need