1

I am using mathspec with XeTeX (Version 3.14159265-2.6-0.999991 (TeX Live 2019)), and the percent sign \% shows up in Computer Modern (or a similar font) in math mode, rather than the font set using mathspec.

There is a previous question – XeTeX/mathspec punctuation issue – showing how to manually add mappings for punctuation characters:

\ernewcommand\eu@MathPunctuation@symfont{Latin:m:n}
\DeclareMathSymbol{,}{\mathpunct}{\eu@MathPunctuation@symfont}{`,}
…

However, I couldn't find the correct way of referring to the percent sign to be able to redefine it in that fashion – \% seems to be the macro \char"25 internally.

So, in short, how do I get

\usepackage{mathspec}
\setmathfont{…}
…
\begin{equation}
   4\%
\end{equation}

to use the glyph from the configured math font?

  • 2
    it would be easier to test answers if your example code was a real test document without ... that generate errors (it always helps to provide a test document) – David Carlisle Mar 03 '20 at 21:18

1 Answers1

4

You can add, before \makeatother in the code provided at https://tex.stackexchange.com/a/74159/4427

\DeclareMathSymbol{\mathpercent}{\mathord}{\eu@MathPunctuation@symfont}{`\%}
\DeclareRobustCommand{\%}{\ifmmode\mathpercent\else\symbol{`\%}\fi}

Note that nowadays it is not recommended to load xltxtra.

egreg
  • 1,121,712