[R] italics and not in main=

Martin Henry H. Stevens hstevens at muohio.edu
Thu Aug 2 16:52:21 CEST 2001


Thank you to Peter D. and Frank H. for info on italics in plots.

----- Original Message ----- 
From: "Peter Dalgaard BSA" <p.dalgaard at biostat.ku.dk>
To: "Martin Henry H. Stevens" <hstevens at muohio.edu>
Cc: <r-help at stat.math.ethz.ch>
Sent: Wednesday, August 01, 2001 4:06 PM
Subject: Re: [R] italics and not in main=


> "Martin Henry H. Stevens" <hstevens at muohio.edu> writes:
> 
> > R 1.3.0, windows
> > I've checked archives, and examples in text, mtext, and title.
> > I am trying to include italicized text in the main title of a figure:
> > 
> > ....,
> > main = "[italics here] species name [italics stop] more plain text"
> > 
> > TIA,
> > Henry
> 
> You forgot to check plotmath:
> 
> main=expression(italic("species name")*" more plain text")
> 
My favorite solution is to use the psfrag style in LaTeX.
You can get psfrag.sty from CTAN if your latex does not have it
already.  I have attached an example from S-Plus that 
with minor changes will work with R.  -Frank Harrell

"tex  <-  function(string, lref='c', psref='c', scale=1, srt=0) 
  paste('\\tex[',lref,'][',psref,'][',
        format(scale),'][',format(srt),']{',string,'}',sep='')

setps(psfrag, toplines=1)
x <- seq(0,15,length=100)
plot(x, dchisq(x, 5), xlab=tex('$x$'),
        ylab=tex('$f(x)$'), type='l')
title(tex('Density Function of the $\\chi_{5}^{2}$ Distribution'))
dev.off()    

The Hmisc setps function uses nice defaults for making small postscript
graphs for reports and books.

The LaTeX code to insert this graph can look like:

\documentclass{article}
\usepackage[scanall]{psfrag}
\begin{document}
\begin{figure}
\includegraphics{psfrag.ps}
\caption{This is the example}
\end{figure}
\end{document}


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list