I have this .Rnw file:
\documentclass{article}
\begin{document}
<<>>=
data(cars)
fit <- lm(cars$speed~cars$dist)
summary(fit)
@
\end{document}
I am using RStudio to build the PDF file, and the summary outputs all kinds of special characters in the line specifying significance codes. (I don't have enough rep points to post pictures, but here is a screenshot:
In the generated .tex file the line reads as
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
These are probably the wrong type of quotes; I can fix the problem by manually typing '
instead of ‘
in the .tex file. I assume it's something to do with Sweave/pdflatex/latex not being able to cope with non-ASCII characters?
Is there anything I can set so that it displays correctly in the PDF file?
\usepackage[utf8]{inputenc}
.knitr
instead of Sweave. This is one of the many surprising Sweave problems thatknitr
has solved.