16 Comments
Guest *Pablo Ramon* @ 2012-04-12 17:08:50 originally posted:
Help!!
I`m trying to set knitr, and, next message appears: Error : could not start the command.
All this configuration as the above explanation. why this error could be??
Thanks
Pablo
I mentioned two editors here. Which one are you talking about? And what command did you put in?
Originally posted on 2012-04-12 17:56:52
Guest *Pablo Ramon* @ 2012-04-12 18:05:48 originally posted:
Hi, I´m using texmaker.
Guest *Pablo Ramon* @ 2012-04-12 20:39:42 originally posted:
And, I put commands:
In knitr: C:/Program Files/R/R-2.14.1/bin/x64/Rscript -e "knitr::knit2pdf('%.Rnw')
In Rsweave: C:/Program Files/R/R-2.14.1/bin/x64/Rscript
thanks
You need to quote the path to Rscript because it contains a space (please take a closer look at what I wrote there). Spaces are often disasters to commands, and if you know well about the PATH variable, I'd recommend you to use PATH so that you do not have to write the full path.
Originally posted on 2012-04-12 20:43:40
Guest *Pablo Ramon* @ 2012-04-12 22:12:31 originally posted:
Yes, in fact there was wrong.
Thanks Yihui
Guest *Peng* @ 2012-09-21 02:16:25 originally posted:
Hi Yihui,
Thanks for this great package. I tried some examples in Rstudio, they work perfectly.
But in TeXmaker, and I did exactly the same thing as described above. The command to run Knitr seems work well, but I keep getting the following error message in the compiling the Rnw file:"Process started
Loading required package: lattice
This is mgcv 1.7-18. For overview type 'help("mgcv-package")'.
processing file: knitr-manual.Rnw
Execution halted
Process exited with error(s)"
Do you know if there is a way that I can fix it?
Thanks
You mean the same Rnw file succeeded in RStudio but not in TeXmaker? Can you try a minimal example like this first? https://github.com/yihui/knitr-examples/blob/master/002-minimal.Rnw
Originally posted on 2012-09-21 03:53:11
Guest *Thomas Zumbrunn* @ 2012-09-24 18:40:30 originally posted:
Hi Yihui
I intend to switch from Sweave to knitr. In my daily work, I use a customised version of the bash script at http://cran.r-project.org/contrib/extra/scripts/Sweave.sh which takes care of running pdflatex and friends after the Sweave document has been processed. Is there something similar for knitr that you know of?
Best wishes
/thomas
My suggestion is use a decent editor which takes care of all these details (e.g. RStudio). You can certainly modify that shell script, but I feel it is overly complicated.
Originally posted on 2012-09-24 19:03:14
Guest *Hank Stevens* @ 2012-12-12 03:20:22 originally posted:
RStudio (last year) crashes and burns with JAGS, and has a few other bugs.
Guest *Henrik Nyhus* @ 2013-01-31 19:30:55 originally posted:
Hi,
I successfully added the following code to make knitr work with texstudio and texmaker (both for Mac OS-X 10.8.2, with all concerned software up to date per Jan. 2013):
Rscript -e "library(knitr); knit2pdf('%.Rnw')"
See the following pictures for details.
texstudio: http://img202.imageshack.us/img202/618/texstudio.png
texmaker: http://img59.imageshack.us/img59/8097/texmaker.png
Best Regards,
Henrik
ps! I noticed, that if the files you want to compile are in a folder with more than one word (e.g. ../Documents/My kniter project/..), it won'twork.
Great. Thanks for sharing it.
Originally posted on 2013-02-05 23:05:14
Guest *ngwalton* @ 2013-09-14 21:21:40 originally posted:
Thanks for sharing this! I modified the code to work with TeXstudio on Windows 7 and to have the resulting pdf open in Sumatra. I had to use the specify lib.loc argument because there's a space in the default R library path on Windows 7. Here's my command (all software up to date as of Sept 2013):
Rscript -e "library(knitr, lib.loc='C:/Program Files/R/R-3.0.1/library'); knit2pdf('%.Rnw'); system('SumatraPDF %.pdf')"
There may be a better solution than using system() to open the compiled pdf , but this is working for me on Win7.
Guest *John Bullock* @ 2013-03-30 01:16:44 originally posted:
The WinEdt instructions won't suffice unless users have configured R so that it loads the knitr package upon startup. (At least, that has been my experience.) For the rest of us, a small tweak will suffice:
under Parameters put "knitr::knit2pdf('%n%t')"
should become
under Parameters put "library(knitr); knitr::knit2pdf('%n%t')"
Thanks! You are right if you want to use any objects/functions in knitr (e.g. opts_chunk$set) inside the Rnw document, otherwise I do not think library(knitr) is necessary.
Originally posted on 2013-03-30 03:00:28
Guest *Андрей* @ 2013-04-04 11:11:50 originally posted:
How can I include one .rnw in another .rnw? For example, I can include one .tex to another with "input{part}" and my IDE (TeXstudio) parse it and add this link to structure panel. How I can do similar thing with .rnw? I thought about "Sexpr{paste(knit(text = knit_expand('part.rnw')), collapse = 'n')}" but it is so ugly and TeXstudio don't add this reference to structure panel. There is normal way?
What you mentioned is pretty much what you are supposed to do: http://yihui.name/knitr/demo/child/
I do not use TeXStudio, and I have no idea about the TeXStudio support of child documents. Sorry.
Originally posted on 2013-04-04 23:14:29
Guest *Андрей* @ 2013-04-05 01:24:29 originally posted:
Thanks! What LaTeX IDE do you use?
LyX: http://yihui.name/en/2012/10/lyx-vs-latex/
Originally posted on 2013-04-05 02:07:07
Guest *astralth* @ 2013-05-30 07:21:51 originally posted:
Hi, thanks for the great work !
I just needed to mention that the command provided for texmaker gives errors ('knit_child' function not found) when using Sexpr{knit_child('path')}.
However, it works just fine by replacing it with : Rscript -e "library(knitr); knit('%.Rnw')"
Cheers
Thanks! You can also call library(knitr) inside your Rnw document.
Originally posted on 2013-05-31 20:10:36
Guest *tirip01* @ 2013-07-26 23:02:51 originally posted:
Hi, Mareks solution for Kile is unnecessarily complicated.
Open the 'Build' tab, select 'New..', type 'knitr' and press 'Finish'. In the 'General' tab enter 'Rscript' in the 'Command' field.
Below, in the 'Options' field type: -e "knitr::knit2pdf('%source')"
Go to 'Advanced' tab and set Rnw as 'Source extension' and pdf as 'Target extension'.
In menu select 'Compile'
That's it.
That indeed looks cleaner. I'll add your method to this page. Thanks a lot!
Originally posted on 2013-07-27 04:07:18
Guest *Roman Luštrik* @ 2013-12-12 14:21:37 originally posted:
Can you mention in the text, that when using the path in Texmaker, it's very important to use single quotes on the inside and double quotes on the outside (or vice versa)? I know it's there, but I feel someone could avoid spending some time tracking down the error (like I have just now :) ) just because they're used to using only one type of quotes.
Guest *david allen* @ 2014-07-21 16:00:02 originally posted:
With gedit one can create an external tool:
Rscript -e "library(knitr); knit('$GEDIT_CURRENT_DOCUMENT_NAME')"
Awesome. Thanks for the tip!
Originally posted on 2014-07-22 04:08:06
Guest *aeryyc* @ 2015-02-08 20:51:55 originally posted:
Hi, this is a neat package! I'm using Aquamacs and usually I view compiled latex files in Skim. But when I do this in .rnw with knitr, Acrobat is called automatically. Is there a way to change my setting to not use Skim instead of Acrobat?
Guest *joe* @ 2015-11-01 01:47:26 originally posted:
What if we don't want to use a simple rnw file but embed it within a larger tex file or mix it?
Guest *Zeshan Bilal* @ 2015-12-30 11:55:10 originally posted:
Well this look i have got right tool to my blog management :) This tool might works for what i am looking for from last 2 months :)
WinEdt 9 Crack
Guest *Kenny Bell* @ 2016-08-24 17:54:56 originally posted:
On Ubuntu, when using Texstudio, I use:
Rscript -e library(knitr);library(magrittr);use_series(opts_knit,set)(concordance=TRUE);knit("?m).Rnw");
The other method didn't seem to work when using concordance as the $ gets interpreted as a variable in Bash. You must have the magrittr package installed.
Guest *Diego Acosta* @ 2017-11-29 08:14:27 originally posted:
Dear Yihui Xie,
I am trying to install knit2pdf but haven´t been able to do so because the package is not in the mirrors. Should I install it manually?
Regards,
Diego
PS/ OK, I figured it out... I used this web-page http://www.pauljhurtado.com/latex/texstudio.html to make things happen the way I wanted to... I should have RTFM :D before posting...
What is wrong here?
\documentclass{article}
%\usepackage[T1]{fontenc}
\usepackage[fontset=windows]{ctex}
\begin{document}
Here is a code chunk.
<<foo, fig.height=4>>=
1+1
letters
chartr('xie', 'XIE', c('xie yihui', 'Yihui Xie'))
par(mar=c(4, 4, .2, .2)); plot(rnorm(100))
@
You can also write inline expressions, e.g. $\pi=\Sexpr{pi}$, and \Sexpr{1.598673e8} is a big number.
When using ctex package, this demo can be compiled in RStudio by knitr,
but failed to be compiled in TeXstudio by knitr。
e.g. 中文
\end{document}I find the solution:
When compiled in TeXstudio, you should configure
Rscript.exe -e "knitr::knit2pdf('%.Rnw', compiler = 'xelatex')" Please notice: knit2pdf using tinytex instead of TeXLive or something else.
Sign in to join the discussion
Sign in with GitHub