TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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. – rdhs Feb 4 '12 at 20:54
up vote 2 down vote accepted

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 http://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

share|improve this answer
This isn't a solution. Compare the commas in This, a sample sentence, with the comma in mod 3,. – rdhs 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 posting your answer, you agree to the privacy policy and terms of service.

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