2

I have sweave file like this:

test.rnw

\documentclass[letter,10pt]{article}

\usepackage{amsmath}
\usepackage{amscd}

\usepackage{ifthen}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage[top=1.0in, bottom=1.0in, left=0.75in, right=0.75in]{geometry}


\begin{document}
\title{Top areas of focus for \\ This is a test}
\author{ test }
\maketitle
\pagebreak
\tableofcontents
\pagebreak

\section{Introduction}
this is a test document

\end{document}

I am trying to manually run knitr agaist it and produce a pdf file like this:

 knit2pdf("test.rnw", "test.pdf", compiler="texi2pdf")

I am getting an error:

running command '"G:\latex\latex\miktex\bin\x64\texi2dvi.exe" --quiet --pdf "test.pdf"  -I "G:/R/R-2.15.2/share/texmf/tex/latex" -I "G:/R/R-2.15.2/share/texmf/bibtex/bst"' had status 1 

I am very new to knitr, can anybody tell me what I am doing wrong? Basically I would like to combile an .rnw file and output it to a pdf file.

user1471980
  • 10,127
  • 48
  • 136
  • 235
  • 1
    Try, in the R console, simply `knit("test.rnw")`. It should give info to the console and put the .tex in your current working directory, if it was successful. If not, the msgs in the console will generally give you an idea of what's up. Since you have no R code in your Rnw then you might not see anything in the console. If it makes the .tex, just process that however you normally do so. – Bryan Hanson Jan 24 '13 at 18:46
  • Works for me in RStudio (with a warning about ignoring the `letter` directive). – joran Jan 24 '13 at 18:51
  • You get an error or just a warning? – agstudy Jan 24 '13 at 18:56
  • 1
    `knit2pdf()` is for lazy experts (the `compiler` argument is currently a nasty hack); if you are new to `knitr`, I recommend you to call `knit()` to generate the tex file, and run `pdflatex` on that; or use a capable editor and forget about all these gory details (e.g. RStudio) – Yihui Xie Jan 24 '13 at 20:20

0 Answers0