yihui/knitr — Issue #62: Apparent problem with double quotes: "x"
Author: walmes
Created: 2011-12-16 18:29:42+00:00
State: open

Hello Yihui,

I'm using you elegant package knitr lately. Running a simple document I get an error message relative the use of double quotes (```" "```). Using single quotes (```' '```) there is no problem. My actual (simple/minimal) Rnw document is:

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\onehalfspacing

<>=
options(replace.assign=TRUE, width=60)
## a common hook for decrease spacing in code lines
hook_spacing = function(x, options) {
paste("\\begin{spacing}{0.8}\n", x,
"\\end{spacing}\n", sep="")
}
knit_hooks$set(source = function(x, options) {
paste("\\begin{spacing}{0.8}\n", x,
"\\end{spacing}\n", sep="")
}, output = function(x, options) {
paste("\\begin{spacing}{0.8}\n", x,
"\\end{spacing}\n", sep="")
}, warning=hook_spacing, message=hook_spacing, error = hook_spacing)
@

\title{Testing knitr}
\author{Walmes Zeviani}

\begin{document}

\maketitle

<>=
f <- quote(sin(x)-x^2/16)
fx0 <- function(x){ eval(f) }
f1 <- D(f,"x") # problem with double quotes
fx1 <- function(x){ eval(f1) }
@

\end{document}
```

As you can see, I'm using an environment to reduce spacing lines for input/output (my text is 1.5 line) based on that you provide line numbers with ```listings```. Well, I get this error message when compiling:

```bash
! Argument of \language@active@arg" has an extra }.

\par
l.402 ...blem{\ }with{\ }double{\ }quotes,{\ }"x"}
\hspace*{\fill}\\

```

Have you some suggestion how solve this? Thank you.