3

Running xelatex on

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{CambriaMath.ttf}
%\setmathfont[Ligatures=TeX,range={\backprime}]{TeX Gyre Termes Math}
%\setmathfont[Ligatures=TeX,range={"2035}]{TeX Gyre Termes Math}
%\setmathfont[Ligatures=TeX,range={"02035}]{TeX Gyre Termes Math}
%\setmathfont[range={\backprime}]{texgyretermes-math.otf}
%\setmathfont[range={"2035}]{texgyretermes-math.otf}
%\setmathfont[range={"02035}]{texgyretermes-math.otf}
\begin{document}
\(\sigma^{\backprime}\)
\end{document}

with both CambriaMath.ttf and texgyretermes-math.otf in the working directory results in

bogus output

As the reader sees above, I undertook several attempts of using \setmathfont; none of them works for me. lualatex produces a no better result.

How to get the reverse prime (as the right superscript) when using Cambria Math as the main math font? Of course, I'd also like to get proper copyable Unicode σ‵ (or similar for the backprime) in the text layer of PDF produced.

Versions used:

  • This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2019/dev/Debian) (preloaded format=xelatex 2019.4.18)

  • LaTeX2e <2018-12-01>

  • Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files standalone

  • Package: unicode-math 2019/02/15 v0.8n Unicode maths in XeLaTeX and LuaLaTeX

  • Cambria Math versions 5.96 or 6.96 (the only difference wrt. issue is that the missing-symbol image looks differently).

Crosspost: http://github.com/wspr/unicode-math/issues/529

3
  • I have compiled your code with Papeeria and I have the correct output: papeeria.com/p/704897e5-7ef7-4eba-a4a6-60b518cb05f8#/main.tex. Try to put your code into main.tex (delete it); you choice with menu (downarrow) TexLive2019 and after click on Compile. – Sebastiano Aug 19 '19 at 22:16
  • You're right. Honestly I don't know :-( sigma is different looks like the classic CM. In the background there is your code. – Sebastiano Aug 19 '19 at 22:43
  • Are you sure that you want CambriaMath.ttf and not cambria_01.ttf or cambria.ttc? – Davislor Aug 20 '19 at 4:44
2

One side note: on many systems, Cambria Math will be in the file cambria_01.ttf or cambria.ttc. Therefore, the only portable way to select it is by its display name. That’s not the cause of your error, but it’s something I needed to change to get your MWE to compile.

It’s a bug in unicode-math that range=\backtick and range="2035 don’t work. As of August 2019, \DeclareMathSymbol does not work either. Here is a workaround, based on this answer.

\documentclass{standalone}
\usepackage{unicode-math}

\defaultfontfeatures{Scale=MatchLowercase}

\setmathfont{Cambria Math}

\newfontface\STIXTwoMath{STIX Two Math}[NFSSFamily=STIXTwoFamily]
\DeclareSymbolFont{Missing}{TU}{STIXTwoFamily}{m}{n}
\Umathchardef\varbackprime="0 \symMissing "2035

\newcommand\textbackprime{{\STIXTwoMath\symbol{"2035}}}

\begin{document}
\(\sigma^{\varbackprime}\)
\end{document}

Cambria & STIX Two sample

This has more space to the sides of the tick than you might want.

A simpler approach is to use \text from amsmath to display the symbol from text mode. à la \textbackprime above.

5
  • @MdAyq6 This one is closely related: github.com/wspr/unicode-math/issues/485 – Davislor Aug 20 '19 at 7:19
  • @MdAyq6 TrueType collections are supported through fontspec. – Davislor Aug 20 '19 at 7:22
  • Always very good :-) is the first time I read the extension .ttc. What files are they? – Sebastiano Aug 20 '19 at 11:31
  • 1
    @MdAyq6 The way that just works is the way I wrote it: \setmathfont{Cambria Math}. If you want to make sure you’re loading the right version, \setmathfont{cambria.ttc}[FontIndex=1]. You need to know, or at least guess, the index of the font you want within the .ttc. You don’t have to load fontspec separately: unicode-math loads it and supports all its commands. To see if it worked, run pdffonts on the output file or check the log to see if the font has script=MATH. – Davislor Aug 20 '19 at 16:27
  • @Davislor Very near to the 10k :-) My sincere compliments. – Sebastiano Aug 21 '19 at 19:25

Your Answer

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