I tried to include LaTeX expressions in the header of a plot in R. (1) Using PlotMath, LaTeX type expressions, e.g., R^x is possible, however, dist<-"...." (some string) ....main=expression(R^x,dist).... does not substitute the value of dist, as well do the proper superscripting. Also within an expression, substitute does not work, (apparently), so that explicit substituting of "dist" does not take place. Pasting separately, like ....main=paste(expression(R^x),dist)... does not work either. Is there any way out? Even if it is "trivial" please indicate any source of help. (2) Problem in (1) is stated for a general graphics device and PlotMath has limited capabilities. I am aware that the "TeX" option for the graphics device is a way out, but when converted to eps or ps, and included in a LaTeX document, and compiled to produce pdf/ps files, the headers are not converted into meaningful symbols. Has anyone tried anything on this? Many journals now have online submission procedures, which compile pdf files on site after the LaTeX file , and the figures, mostly required to be eps, are uploaded. I expect others to have come across similar problems. Regards Supratik.
Roy, Supratik wrote:> I tried to include LaTeX expressions in the header of a plot in R. > (1) Using PlotMath, LaTeX type expressions, e.g., R^x is possible, however, > dist<-"...." (some string) > ....main=expression(R^x,dist).... > does not substitute the value of dist, as well do the proper superscripting. > Also within an expression, substitute does not work, (apparently), so that > explicit substituting of "dist" does not take place. Pasting separately, > like > ....main=paste(expression(R^x),dist)... does not work either. > Is there any way out? Even if it is "trivial" please indicate any source of > help.See the examples in ?plotmath and how to use substitute. Also, you might want to look into the R Help Desk column in R News 2(3).> (2) Problem in (1) is stated for a general graphics device and PlotMath has > limited > capabilities. I am aware that the "TeX" option for the graphics deviceWhat is the "TeX" option, please? Uwe Ligges> is a way out, but when converted to eps or ps, and included in a LaTeX document, > and compiled to produce pdf/ps files, > the headers are not converted into meaningful symbols. Has anyone tried > anything on this?>> Many journals now have online submission procedures, which compile pdf files > on site > after the LaTeX file , and the figures, mostly required to be eps, are > uploaded. I expect > others to have come across similar problems. > > Regards > Supratik. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Fri, 30 Jul 2004, Roy, Supratik wrote:> > I tried to include LaTeX expressions in the header of a plot in R. > (1) Using PlotMath, LaTeX type expressions, e.g., R^x is possible, however, > dist<-"...." (some string) > ....main=expression(R^x,dist).... > does not substitute the value of dist, as well do the proper superscripting. > Also within an expression, substitute does not work, (apparently), so that > explicit substituting of "dist" does not take place.Working from the example in FAQ 7.15 suggests something like dist=" is the xth power of R" plot(rnorm(10),main=substitute(R^x*dist,list(dist=dist))) which works fine. A slightly more compact version is plot(rnorm(10),main=bquote(R^x*.(dist))) If that output isn't what you want you will need to explain what you want more precisely. -thomas
Sorry!, by "TeX" I meant the PicTeX option for graphics devices (which in anycase produces bulky files!). -----Original Message----- From: Uwe Ligges To: Roy, Supratik Cc: 'r-help at stat.math.ethz.ch' Sent: 7/30/2004 3:58 PM Subject: Re: [R] LaTeX in R Roy, Supratik wrote:> I tried to include LaTeX expressions in the header of a plot in R. > (1) Using PlotMath, LaTeX type expressions, e.g., R^x is possible,however,> dist<-"...." (some string) > ....main=expression(R^x,dist).... > does not substitute the value of dist, as well do the propersuperscripting.> Also within an expression, substitute does not work, (apparently), sothat> explicit substituting of "dist" does not take place. Pastingseparately,> like > ....main=paste(expression(R^x),dist)... does not work either. > Is there any way out? Even if it is "trivial" please indicate anysource of> help.See the examples in ?plotmath and how to use substitute. Also, you might want to look into the R Help Desk column in R News 2(3).> (2) Problem in (1) is stated for a general graphics device andPlotMath has> limited > capabilities. I am aware that the "TeX" option for the graphics deviceWhat is the "TeX" option, please? Uwe Ligges> is a way out, but when converted to eps or ps, and included in a LaTeXdocument,> and compiled to produce pdf/ps files, > the headers are not converted into meaningful symbols. Has anyonetried> anything on this?>> Many journals now have online submission procedures, which compile pdffiles> on site > after the LaTeX file , and the figures, mostly required to be eps, are > uploaded. I expect > others to have come across similar problems. > > Regards > Supratik. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html