[R] TikzDevice and texi2dvi
Dear All, I am starting to use the tikzDevice package, but I am experiencing some (minor problems). If I try to run the script at the end of the email, I get the following error Error in tools::texi2dvi(normal.tex, pdf = T) : Running 'texi2dvi' on 'normal.tex' failed. Messages: sh: /usr/bin/texi2dvi: not found How do I install the missing texi2dvi? I found some reference to it at http://bit.ly/bSYbxk but I have not understood well whether it is should already be part of my R base installation or not. I am running R 2.11 on Ubuntu 9.10. Many thanks Lorenzo ###à #Load the tikzDevice package, if you dont have it, install with: # install.packages(tikzDevice, repos=http://R-Forge.R-project.org;) require(tikzDevice) # The following wwill create normal.tex in the working # directory the first time this is run it may take a long time because the # process of calulating string widths for proper placement is # computationally intensive, the results will get cached for the current R # session or will get permenantly cached if you set # options( tikzMetricsDictionary='/path/to/dictionary' ) which will be # created if it does not exist. Also if the flag standAlone is not set to # TRUE then a file is created which can be included with \include{} tikz('normal.tex', standAlone = TRUE, width=5, height=5) # Normal distribution curve x - seq(-4.5,4.5,length.out=100) y - dnorm(x) # Integration points xi - seq(-2,2,length.out=30) yi - dnorm(xi) # plot the curve plot(x,y,type='l',col='blue',ylab='$p(x)$',xlab='$x$') # plot the panels lines(xi,yi,type='s') lines(range(xi),c(0,0)) lines(xi,yi,type='h') #Add some equations as labels title(main=$p(x)=\\frac{1}{\\sqrt{2\\pi}}e^{-\\frac{x^2}{2}}$) int - integrate(dnorm,min(xi),max(xi),subdivisions=length(xi)) text(2.8, 0.3, paste(\\small$\\displaystyle\\int_{, min(xi), }^{, max(xi), }p(x)dx\\approx, round(int[['value']],3), '$', sep='')) #Close the device dev.off() # Compile the tex file tools::texi2dvi('normal.tex',pdf=T) # optionally view it: # system(paste(getOption('pdfviewer'),'normal.pdf')) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] TikzDevice and texi2dvi
I think I solved my problems by resorting to the Ubuntu packages at http://bit.ly/c8izKy Cheers Lorenzo Dear All, I am starting to use the tikzDevice package, but I am experiencing some (minor problems). If I try to run the script at the end of the email, I get the following error Error in tools::texi2dvi(normal.tex, pdf = T) : Running 'texi2dvi' on 'normal.tex' failed. Messages: sh: /usr/bin/texi2dvi: not found How do I install the missing texi2dvi? I found some reference to it at http://bit.ly/bSYbxk but I have not understood well whether it is should already be part of my R base installation or not. I am running R 2.11 on Ubuntu 9.10. Many thanks Lorenzo ###à #Load the tikzDevice package, if you dont have it, install with: # install.packages(tikzDevice, repos=http://R-Forge.R-project.org;) require(tikzDevice) # The following wwill create normal.tex in the working # directory the first time this is run it may take a long time because the # process of calulating string widths for proper placement is # computationally intensive, the results will get cached for the current R # session or will get permenantly cached if you set # options( tikzMetricsDictionary='/path/to/dictionary' ) which will be # created if it does not exist. Also if the flag standAlone is not set to # TRUE then a file is created which can be included with \include{} tikz('normal.tex', standAlone = TRUE, width=5, height=5) # Normal distribution curve x - seq(-4.5,4.5,length.out=100) y - dnorm(x) # Integration points xi - seq(-2,2,length.out=30) yi - dnorm(xi) # plot the curve plot(x,y,type='l',col='blue',ylab='$p(x)$',xlab='$x$') # plot the panels lines(xi,yi,type='s') lines(range(xi),c(0,0)) lines(xi,yi,type='h') #Add some equations as labels title(main=$p(x)=\\frac{1}{\\sqrt{2\\pi}}e^{-\\frac{x^2}{2}}$) int - integrate(dnorm,min(xi),max(xi),subdivisions=length(xi)) text(2.8, 0.3, paste(\\small$\\displaystyle\\int_{, min(xi), }^{, max(xi), }p(x)dx\\approx, round(int[['value']],3), '$', sep='')) #Close the device dev.off() # Compile the tex file tools::texi2dvi('normal.tex',pdf=T) # optionally view it: # system(paste(getOption('pdfviewer'),'normal.pdf')) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TikzDevice and texi2dvi
Lorenzo Isella wrote: I think I solved my problems by resorting to the Ubuntu packages at http://bit.ly/c8izKy Cheers Lorenzo Dear All, I am starting to use the tikzDevice package, but I am experiencing some (minor problems). If I try to run the script at the end of the email, I get the following error Error in tools::texi2dvi(normal.tex, pdf = T) : Running 'texi2dvi' on 'normal.tex' failed. Messages: sh: /usr/bin/texi2dvi: not found How do I install the missing texi2dvi? I found some reference to it at http://bit.ly/bSYbxk but I have not understood well whether it is should already be part of my R base installation or not. I am running R 2.11 on Ubuntu 9.10. Many thanks Lorenzo Hi Lorenzo, It appears you are missing the texi2dvi program- this is a tool provided by TeX or TeXinfo distributions, not R or tikzDevice. In order to use the tikzDevice, you will need to install a TeX distribution on your machine. As you are running Linux, I highly recommend the TeXlive distribution, which you can get from: http://www.tug.org/texlive/ I recommend using the net installer at: http://www.tug.org/texlive/acquire-netinstall.html I would advise this over Debian packages, as it has been my experience that the packages can be horribly out of data- for example the Ubuntu package repository lists a build based on TeXlive 2007 as being available for 9.10. The tikzDevice requires PGF/TikZ 2.00 to function properly which in turn requires TeXlive 2008 or later. Hope this helps! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://r.789695.n4.nabble.com/TikzDevice-and-texi2dvi-tp2067230p2068350.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.