Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How does one set the font for text inside a math environment? If I use \setmathsfont(Latin){FontName}, I can change the font for individual letters in the math environment, but not for functions such as \sin. (These aren't controlled by the set "Symbols" either.)

Here's a MWE:

\documentclass[a4paper,12pt]{article}

\usepackage[MnSymbol]{mathspec} 
\usepackage[no-sscript]{xltxtra}
\defaultfontfeatures{Mapping=tex-text}

\setmainfont{Times}

\setmathsfont(Digits){Times}
\setmathsfont(Latin){Times}
%\setmathsfont(Symbols){Times}

\begin{document}

Some text digits 1, 2, 3 and some math digits $1, 2, 3$. 

Some italic text \textit{text}, and some math text $text$.

But, we have \textit{sin x} and $\sin x$. Or, \textit{arctan x} and $\arctan x$.

\end{document} 
share|improve this question
    
The math-font system is a rather complex system, but I think the question is answered quite well in this related thread: how to select math font in document. –  aagaard Dec 25 '12 at 11:41

1 Answer 1

You have to do \setmathrm; here I use TeX Gyre Termes, but what font you're using is irrelevant.

\documentclass[a4paper,12pt]{article}

\usepackage{mathspec}
\defaultfontfeatures{Ligatures=TeX}

\setmainfont{TeX Gyre Termes}

\setmathsfont(Digits){TeX Gyre Termes}
\setmathsfont(Latin){TeX Gyre Termes}
\setmathrm{TeX Gyre Termes}

\begin{document}

Some text digits 1, 2, 3 and some math digits $1, 2, 3$.

Some italic text \textit{text}, and some math text $text$.

Also $\sin x$ and $\arctan x$.

\end{document}

enter image description here

If you have a recent and updated TeX Live, you can also use the new TG Termes Math font with unicode-math:

\documentclass[a4paper,12pt]{article}

\usepackage{unicode-math}
\defaultfontfeatures{Ligatures=TeX}

\setmainfont{TeX Gyre Termes}
\setmathfont{TG Termes Math}

\begin{document}

Some text digits 1, 2, 3 and some math digits $1, 2, 3$.

Some italic text \textit{text}, and some math text $text$.

Also $\sin x$ and $\arctan x$.

\end{document}

This is actually much better than mathspec, because the math font has the right parameters for being used in formulas.

share|improve this answer
    
Thanks, \setmathrm does the trick. –  Conic Dec 25 '12 at 17:11

Your Answer

 
discard

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.