5

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?

Sean
  • 491
  • 1
    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 09:32
  • 2
    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
  • 1
    Related (but here it appears that the "R" is not desired in sans serif font): http://tex.stackexchange.com/questions/73089/forcing-roman-font-in-latex 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

1 Answers1

3

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
egreg
  • 1,121,712