Skip to content
Prev 206371 / 398503 Next

HTML translation problem in R-2.10.1

On 15/01/2010 6:24 AM, Jim Lemon wrote:
The \samp{} macro is defined (in Writing R Extensions) as

\samp{text}
     Indicate text that is a literal example of a sequence of 
characters, entered verbatim. No wrapping or reformatting will occur. 
Displayed using typewriter font if possible.

In 2.8.x and 2.9.x, it said something similar, but was less explicit:

\samp{text}
     Indicate text that is a literal example of a sequence of characters.

The Perl converters in earlier versions may have processed \link macros 
within this, but I think that was an error.  This macro should be used 
to document things like Rd macros or other literal sequences of 
characters, without requiring escapes (or with minimal requirements for 
escapes).

Part of the problem with writing a grammar for Rd files is that usage 
was so irregular, so this looks like a case where I decided on something 
that was close to the documentation, but not so close to the existing 
implementation.
You don't want to use \code{} unless you are entering R code.  I don't 
think you've said exactly what your goal is:  is it just to get a 
typewriter font for text?  I'm not sure there's a way to do that, and it 
does seem like a reasonable thing to want to do, but the current styles 
don't support it.  We've got \emph, \bold, \strong, but no \texttt 
equivalent.  What would you use it for?

Duncan Murdoch