[R] [OT] getting a ~ character in LaTeX

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Jan 16 20:55:18 CET 2001


On 16 Jan 2001, Douglas Bates wrote:

> I am writing course notes in LaTeX.  In the part where I am describing
> model-fitting functions in R I want to use a ~ character inline.  If I
> am displaying an example of R code in its own environment I use the
> alltt environment, which protects the ~ character.  I have forgotten
> how to protect the ~ when I am writing something like
>   The operator `~' is used to define a model formula in \R.
>   The left hand side is evaluated as the response.  The right hand
>   side can consist of several \Emph{terms} with special meanings
>
> I welcome suggestions.

There is no really good simple idea. $sim$ is not too bad, \verb|~|
will give a raised tilde in most TeX fonts: you can also use
\textasciitilde (as used by Rdconv) in normal text.

V&R (well, R) made a virtual monospaced font taking ~ from a IBM
public version of Courier, scaled to fit, plus

\def\~{{\tt\char'176}}

which make \~ work as you might hope.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list