3

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} 
1

1 Answer 1

2

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .