I'm a beginner in using knitr to generate a report. I have a R script (see below for an example; BTW I'm using RStudio for all of this) that runs without error and the output is a data frame. My rnw.file looks like this:

% !Rnw weave = knitr

which displays the table quite nicely. The only problem I have is with the ">" (greater than) sign in the last column which is shown as "¿".

In found something about using


but this doesn't seem to do the trick here. Having included this, I can start compiling the script but after 10 minutes or so (and w/o it only took me some seconds to compile) I run into an error (exit code: 1).

Also, $>$ will not work for me here, and is displayed as $¿$ in the pdf. I've already asked this question here w/o getting a elegant solution so far.

Thanks in advance!

R.script (saved as "test.R"):

temp <- 12
test.mat <- as.data.frame(matrix(NA,ncol=2,nrow=1))
test.mat$V1 <- 2
test.mat$V2 <- paste(temp,"subjects > 28 days",sep=" ")
  • Find out what's the problem with \usepackage[T1]{fontenc} by compiling a small document without some R.script. Commented Jun 25, 2015 at 8:48
  • Actually, I can't quite figure it out. It's also not working in an ordinary tex.document (using TeXnicCenter). I tried \usepackage[latin1]{inputenx} and can compile w/o problems, but not solving the initial problem with the ">" symbol being displayed as "¿".
    – Johanna
    Commented Jun 25, 2015 at 9:43
  • Well you will have to figure it out. \usepackage[T1]{fontenc} should work. If it doesn't work in a minimal document your system is broken. Show the log-file. Commented Jun 25, 2015 at 9:51

1 Answer 1


I can't explain why it is working now, but here is what I found I should use in the preambel:


Found this in another thread (not really related to my question), but now I get what I want in the R output (no changes required in the R.script) as well as in the pdf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .