Skip to content

Tildes in R docmentation.

2 messages · Rolf Turner, Brian Ripley

#
I'm getting flummoxed when trying to putting a tilde (``~'') --- as
in a formula --- into an R documentation file, or rather in getting
one to appear in the *.dvi output that results from converting a *.Rd
file.

In my *.Rd file I wrote an expression of the form

	\code{cbind(x,y) ~ z}

This shows up in the appropriate way in the plain text help,
and in the html help.  But if I do

	R CMD Rd2dvi foo.Rd

I get hang-ups at the latex processing stage.  I get told

===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
! Undefined control sequence.
<argument> cbind(x,y) \textasciitilde 
                                          {} z
l.93 \code{cbind(x,y) \textasciitilde{} z}
===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===

The documentation on writing documentation tells me that I
should, in ``regular text'' enter ~ as 

	\eqn{\mbox{\textasciitilde}}{~} or \eqn{\sim}{~}

but that no characters other than ``%'' and ``\'' are ``special''
inside verbatim environments such as \code{}.

However the Rd to latex processor seems to be converting the ~
into ``\textasciitilde{}'' --- with a pair of braces on the end
as if there should be an argument to the control sequence.  And
then latex is unable to find that control sequence.

Can anyone explain to me what's going on, and how to go about
solving the problem?

Is this a bug, or am I doing something wrong?  Presumably
``\textasciitilde'' ought to be lurking about somewhere, but
it ain't lurking about on our system.  Where could I get it?
I.e. what latex package or *.sty file would it be found in,
and where would that package/*.sty file be located?

Thanks.

					cheers,

						Rolf Turner
						rolf at math.unb.ca
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
This is widely used in the system help files. See e.g lm.Rd which has
\code{response ~ terms}.

That works in text, html and latex (how do you think we get a reference
manual made?).

\textasciitilde is a standard part of latex (in file latex.ltx).  The
feature was introduced in the 1995/12/01 release (see the usrguide.tex) so
it looks as if your latex is more than 5 years' old, or broken.

[...]
That's not what {} means.  It's an empty token to escape the following
space.  (la)tex does not use {} to introduce arguments.
You do need a reasonably recent fully functional latex system.  Probably no
more than a couple of years' old (we don't have ancient installations
around to test).

[...]