From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>

Date: Wed, 27 Feb 2008 20:33:39 +0000 (GMT)

Date: Wed, 27 Feb 2008 20:33:39 +0000 (GMT)

On Wed, 27 Feb 2008, Gavin Simpson wrote:

> On Wed, 2008-02-27 at 11:35 +0100, Paul Hiemstra wrote:

*>> Dear All,
**>>
**>> I try to use Sweave to make a document. But when I use the Sweave()
**>> command on it and build a pdf with pdflatex (3.141592-1.40.3) my
**>> apostrophes are replaced by some gibberish (an 'a' with a hat on it, a
**>> capital A with a arc pointing upwards on it and a capital Y with two
**>> points on it). If I manually replace the apostrophes using the keyboard,
**>> I get a different looking apostrophe and the output is correct.
**>>
**>> I'm using Debian Linux (Lenny) with TexLive, Kile and R 2.6.1.
**>
**> I presume that R is running in a UTF-8 locale on your Debian box (or
**> some other locale that is different to the one pdflatex is working in);
*

His email seens to be in UTF-8, but as he failed to follow the posting guide I decided not to respond with unnecessary guesswork.

> the fancy quotes used in some print methods in R aren't available in all

*> locale/font encodings and these get interpreted as the "gibberish" you
**> are seeing.
**>
**> Stick this in your preamble and see if it works (you might need to
**> install a TexLive package from your usual Debian repository to get this
**> [LaTeX] package installed):
**>
**> \usepackage[utf8x]{inputenc}
**>
**> it did for me on my Fedora box when I first came across this issue.
*

The standard 'spell' is \usepackage[utf8]{inputenc}: that is what R itself uses when making a package manual if the encoding is UTF-8. That should come with any reasonably recent LaTeX (dates in the LaTeX world are imaginary, but I think it is from the '2003' release).

*>
**> HTH
**>
**> G
**>
**>>
*

>> This is a sample, the problem is in the lm output in the "Signif. codes"

*>> line:
**>>
**>> \documentclass[a4paper,10pt]{article}
**>> \title{Spam}
**>> \author{F. Bar}
**>>
**>> \begin{document}
**>> <<reg>>=
**>> n <- 50
**>> x <- seq(1, n)
**>> a.true <- 3
**>> b.true <- 1.5
**>> y.true <- a.true + b.true * x
**>> s.true <- 17.3
**>> y <- y.true + s.true * rnorm(n)
**>> out1 <- lm(y ~ x)
**>> summary(out1)
**>> @
**>> \end{document}
**>>
**>> And the resulting .tex file:
**>>
**>> \documentclass[a4paper,10pt]{article}
**>> \title{Spam}
**>> \author{F. Bar}
**>>
**>> \usepackage{Sweave}
**>> \begin{document}
**>> \begin{Schunk}
**>> \begin{Sinput}
**>> > n <- 50
**>> > x <- seq(1, n)
**>> > a.true <- 3
**>> > b.true <- 1.5
**>> > y.true <- a.true + b.true * x
**>> > s.true <- 17.3
**>> > y <- y.true + s.true * rnorm(n)
**>> > out1 <- lm(y ~ x)
**>> > summary(out1)
**>> \end{Sinput}
**>> \begin{Soutput}
**>> Call:
**>> lm(formula = y ~ x)
**>>
**>> Residuals:
**>> Min 1Q Median 3Q Max
**>> -31.9565 -9.4745 -0.1708 7.3759 44.6538
**>>
**>> Coefficients:
**>> Estimate Std. Error t value Pr(>|t|)
**>> (Intercept) -0.07386 4.64712 -0.016 0.987
**>> x 1.57405 0.15860 9.924 3.25e-13 ***
**>> ---
**>> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 .’ 0.1 ‘ ’ 1
**>>
**>> Residual standard error: 16.18 on 48 degrees of freedom
**>> Multiple R-Squared: 0.6723, Adjusted R-squared: 0.6655
**>> F-statistic: 98.49 on 1 and 48 DF, p-value: 3.245e-13
**>> \end{Soutput}
**>> \end{Schunk}
**>> \end{document}
**>>
**>> cheers and thanks for any help,
**>> Paul
**>>
**> --
**> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
**> Dr. Gavin Simpson [t] +44 (0)20 7679 0522
**> ECRC, UCL Geography, [f] +44 (0)20 7679 0565
**> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
**> Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
**> UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
**> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
**>
**> ______________________________________________
**> R-help_at_r-project.org mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
**> and provide commented, minimal, self-contained, reproducible code.
**>
*

-- 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595Received on Wed 27 Feb 2008 - 20:40:38 GMT______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 27 Feb 2008 - 22:30:17 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*