From bbolker at gmail.com  Tue Jan 24 17:44:54 2012
From: bbolker at gmail.com (Ben Bolker)
Date: Tue, 24 Jan 2012 16:44:54 +0000
Subject: [Rd] Rnw file generated strange symbols in pdf file
References: <4F1E8DA7020000DD00024CCA@gwmail3.harthosp.org>
Message-ID: <loom.20120124T173204-296@post.gmane.org>

Zhu Wang <Zwang <at> ccmckids.org> writes:

> I found my Rnw file generated strange symbols in pdf file. 
> For instance, on page 4 of the following file,
> 
> http://cran.r-project.org/web/packages/cts/vignettes/kf.pdf

> you can see Belcher et~al on line 2, and Figure~1 on line 5. The
> symbol ~ should not appear in the pdf file although the symbol was
> in the original Rnw file (something like Figure~\ref{...},
> section~\ref{...}). On page 1, the symbol ~ also appears after
> Keywords but in my original Rnw file I have \Keywords{continuous
> time autoregressive model, state space model, Kalman filter, Kalman
> smoothing, \proglang{R}}.
 
> The symbol ~ didn't appear in the generated pdf file with the early
> R version before 2.14, if my memory serves me correctly. So what's
> wrong here and how to correct it rather than modifying my original
> Rnw file?

  This has come up before, I'm not sure what the current status is,
not what gets run on CRAN.  I know that if I use texi2pdf on my
(now fairly old) 10.04 version of Ubuntu, I get the 'tilde problem'
if I use texi2pdf but not if I use pdflatex.  If I \usepackage[english]{babel}
the problem also goes away.

References:

http://comments.gmane.org/gmane.comp.lang.r.debian/848

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=534458

http://www2.it.lut.fi/wiki/doku.php/common/latex_hints  says:
If you use both natbib and babel packages, load natbib before babel to
prevent tilde showing up in citations. Loading natbib after babel and
using citep-command will make ?et al.? shown as ?et~al.?.



[Rd] Rnw file generated strange symbols in pdf file
Ben Bolker