# LaTeX “command” /incantation for R

I am using the tufte-handout class in LaTeX and I want to refer to R using the "correct" sans-serif font. I am currently using

\newcommand{\R}{ {\bf \sffamily R } }


used as ...

... function in the \verb|spatstat| \R package ...


What LaTeX "command" / incantation would you use?

-

## migrated from stackoverflow.comSep 28 '12 at 9:59

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

Rather than flagging to close just because it's easy to do, why not flag for moderator attention to migrate, even though it takes a little more effort?? –  Brent.Longborough Sep 28 '12 at 9:32
This is surely a duplicate; anyway, the answer is \newcommand{\R}{\textbf{\textsf{R}}}. Never use the two letter commands \bf, \sf or \it, they are obsolete. –  egreg Sep 28 '12 at 10:02
@egreg: I agree, I just thought the attitude of the folks @ SO a bit less than constructive –  Brent.Longborough Sep 28 '12 at 11:31
Related (but here it appears that the "R" is not desired in sans serif font): tex.stackexchange.com/questions/73089/… Indeed in the R manual the "R" is just in the roman font (possibly bold in a bold context). So \newcommand{\R}{\textup{R}} might be better. –  egreg Sep 28 '12 at 11:37
@egreg Thanks for the link. Opinion seems mixed, the Springer books (including MASS4) use sans. –  Sean Sep 28 '12 at 11:47

If you want to ensure a sans serif upright bold font, just define

\newcommand{\R}{\textnormal{\sffamily\bfseries R}}}


If you want to avoid typing \R{} is a nice program, then

\usepackage{xspace}
\newcommand{\R}{\textnormal{\sffamily\bfseries R}}\xspace}


will allow

\R is a nice program

-