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 a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with:


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!

share|improve this question

migrated from stackoverflow.com Sep 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
up vote 4 down vote accepted

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

% combine suggestions from @bdh_dtu and @egreg with 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.

share|improve this answer

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:

share|improve this answer
If you also need to ensure upright shape, then \newcommand{\R}{\textup{\textrm{R}}} – egreg Sep 18 '12 at 19:34

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.