Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When running pgfSweave using a file with the following sample code:

\documentclass[letter]{article}
\begin{document} 
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document :
<<>>=
data(airquality)
kruskal.test(Ozone ~ Month, data = airquality)
@
\end{document}

and this command:

pgfSweave("sweave.Snw")

the following error occurs:

...(latex header)....
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty")))
! Missing \endcsname inserted.
<to be read again> 
...(latex crashing out)...

This file works fine with this command:

Sweave("sweave.Snw")

and then "latex sweave.tex" at the command line.

share|improve this question

migrated from stackoverflow.com Feb 13 '12 at 21:46

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I found the answer here:

On Thu, Feb 11, 2010 at 6:36 PM, Yihui Xie wrote: If I understand pgfSweave correctly, a line like this

\usepackage{C:/PROGRA~1/R/some.version/share/texmf/Sweave}

will be added to the preamble of your LaTeX document if you didn't explicitly add \usepackage{Sweave} by yourself.

That will cause the error like

Missing \endcsname inserted

When I add \usepackage{Sweave} to the above file it works fine.

share|improve this answer
1  
This issue just bites users again and again. It is one tiny reason motivating the knitr package: if you like pgfSweave, you probably can experiment with library(knitr); knit('your_input.Rnw') too. –  Yihui Feb 13 '12 at 19:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.