# How to change the text font without changing the font for equations

How to change the text font in a document to "Times" and keep the font for equations unchanged (i.e Computer Modern)?

-
Welcome to TeX.sx! –  texenthusiast Mar 11 '13 at 3:37
for more text and math font choices xelatex and lualatex would be well suited compared to pdflatex –  texenthusiast Mar 11 '13 at 4:45
As it stands this question is too vague. We assume by default you are using LaTeX, but which engine are you using? which fonts would you like to use? As wasteofspace explains below, there are many packages for fonts, some only change the text. –  Andrew Swann Mar 11 '13 at 12:44

One thing I like to do, which might be related to what you want, is to put this in my header:

\renewcommand{\rmdefault}{ptm}


It changes all my body text to Times, but is not the same as

\usepackage{times}


because it doesn't change the typewriter font to Courier, and it doesn't change the sans-serif font to Helvetica; it leaves both of those as the standard Computer Modern versions.

-
without a minimal example, we don't know what you are doing to cause the effect you want to avoid. note that, by default, text and maths use different fonts, anyway; some text font packages change both at the same time, but without an example we can't guess what you are after. –  wasteofspace Mar 11 '13 at 10:53
I wanted to change the font for all the text in the document to Times, except for the default font used for equations which I wanted to remain in Computer Modern. The answer by John Wickerson does exactly that. Thanks and sorry for not having been very explicit. –  Ultimabstract Mar 12 '13 at 4:57

This is the XeLaTeX version using fontspec package:

\documentclass{article}
\usepackage[no-math]{fontspec}
\setromanfont{Times}
\begin{document}
Whatever
\end{document}


In General, the current font depends on some parameters such as 'size', 'family', 'series', and 'shape'. For example, if one says \sffamily, LaTeX will try to change the current font family to sf (stands for 'sans serif') with other parameters unchanged: same size, same series, and same shape.

But before LaTeX changes the current font, LaTeX need to know the exact font family you want. (Since 'sans serif' is not really a font family but more like 'description' about fonts.) This information is stored in \sfdefault. Similarly \rmdefault and \ttdefault contain informations for \rmfamily and \ttfamily.

Therefore editing it by \renewcommand\rmdefault{blahblahblah} results the current font being changed. The good news is that the preceding mechanism affects only the body texts of your document. There is another mechanism designed for math mode. Hence the trick work: math font unchanged.

The bad news is that font packages for body texts sometimes change the math font simultaneously. This makes your document looks more compatible. So fontspec also changes the math font when \setromanfont is design for body texts. And I need to pass [no-math] to stop it.

## Update

under this answer Mico mentioned another bad news: Some fonts are named different on different system. For example Times, Times Roman, Times-Roman, and Times New Roman. It is difficult to tell whether it is a font with nicknames or they are different font looks undistinguishable. So PLEASE DOUBLE CHECK font names whenever you want to try new fonts.

-
You may want to mention that -- depending on the computer system and the naming convention for fonts -- it may be necessary to specify Times Roman or Times New Roman rather than "just" Times to make this font the main text font. –  Mico Sep 17 '14 at 7:03
@Mico The naming convention makes me sick. But in your case, I think Times and Times New Roman are different fonts? –  Symbol 1 Sep 17 '14 at 7:07
There's not much anyone can do about the multitude of names under which a given font (or a close clone of the font) may be known. All you can do, I'm afraid, is point out that a given font may have different names on different systems. (There are some slight differences between Times Roman and Times New Roman, but most people will have a hard time detecting them.) –  Mico Sep 17 '14 at 8:37