# Forcing roman font in LaTeX

I am using a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with:

``````\newcommand{\R}{R}
``````

in order to get the roman "R". The formatting of the thesis means that chapter titles are written in a sans serif font. When I type a chapter title e.g. "\R{} source code" it does not appear in serif, rather in the same sans serif font at the rest of the title.

Is there a way to force the "base" font to be used, regardless of which font is in use at that time?

Sorry for no minimal working example - I'm just not sure which part of the preamble causes the chapter titles to be sans serif!

-

## migrated from stackoverflow.comSep 18 '12 at 19:20

This question came from our site for professional and enthusiast programmers.

Notice that "script font" usually refers to a calligraphic one. I've edited the question title to reflect the text. Welcome to TeX.SX! –  egreg Sep 18 '12 at 19:37

In addition to suggestions from @bdh_dtu and @egreg you might want to also add in the xspace package:

``````\usepackage{xspace}
% combine suggestions from @bdh_dtu and @egreg with xspace
\newcommand{\R}{\textup{\textrm{R}}\xspace}
``````

`\xspace` tries to be clever about inserting a space after the macro if there would normally be one but not if there shouldn't be one, such as when writing `\R.` (i.e. ending the line with `\R` followed by a full stop.

-

Found it! Courtesy of Stefaan Lippens. Use:

``````\textnormal{} % to use the LaTeX font of the main body text (usually serif)
\textrm{}     % to force Roman font (serif)
\textsf{}     % to force sans serif font
``````

Stefaan explains why in detail, and also gives a working example.

To complete my answer, the new command should be changed to:

``````\newcommand{\R}{\textrm{R}}
``````
-
If you also need to ensure upright shape, then `\newcommand{\R}{\textup{\textrm{R}}}` –  egreg Sep 18 '12 at 19:34