[Rd] Rnw file generated strange symbols in pdf file

Ben Bolker bbolker at gmail.com
Tue Jan 24 17:44:54 CET 2012

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.




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

More information about the R-devel mailing list