I am using xelatex to create a document in Armenian. I have the line

\setmainfont [Mapping=tex-text, Scale=MatchUppercase] {DejaVu Serif}

in my tex file to change the font to DejaVu Serif for the text. However the equations are still in Computer Modern. As a result punctuation marks, such as "," are different in and out of equation. This looks a bit ugly, because commas are very different in DejaVu Serif and Computer Modern. How can I fix this?

  • 1
    Check out the mathspec package, which allows you to set the maths text fonts. – Alan Munn Feb 4 '12 at 17:47
  • You could use mathastext or unicode-math for more comprehensive support. – Chel Feb 4 '12 at 20:54

The mathspec package allows you to set maths text fonts. Unfortunately this doesn't actually solve the punctuation problem. Code to do that was posted here: Punctuation marks in math mode in xetex/mathspec Here's an example.

% !TEX TS-program = XeLaTeX

\usepackage{amsmath} % must be loaded before mathspec

\setmainfont [Mapping=tex-text, Scale=MatchUppercase] {DejaVu Serif}
\setmathsfont(Latin,Digits){DejaVu Serif}

% The following code is from https://tex.stackexchange.com/q/38711/2693

This, a sample sentence, is some regular text.

g(n) = 
\frac{2}{3}n & \text{if } n \equiv 0 \mod 3,\\
\frac{4}{3}n + \frac{1}{3} & \text{if } n \equiv 1 \mod 3,\\
\frac{4}{3}n - \frac{1}{3} & \text{if } n \equiv 2 \mod 3.

output of code

| improve this answer | |
  • This isn't a solution. Compare the commas in This, a sample sentence, with the comma in mod 3,. – Chel Feb 4 '12 at 18:43
  • Thank you very much for the answer. Ironically, mathspec doesn't take care of punctuation symbols. For those I've used the answer to this question tex.stackexchange.com/questions/38711/… – Levon Haykazyan Feb 4 '12 at 18:46
  • @rdhs Oops. Thanks. I've modified my answer now incorporating question Levon linked to in his comment so that the answer is complete. – Alan Munn Feb 4 '12 at 20:17

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.