There are many approaches for inserting LaTeX equations, symbols, tables, and other output inside postscript and pdf graphics. Insertion of multi-column tables with proper alignment is a frequently needed feature. The
approach is one of the most general. It can be used more simply than what is described below, but that simple approach only works for
. Here is a general approach.
Here is an example using R.
library(Hmisc)
postscript('psfrag2_fm.eps', pointsize=12,
onefile=FALSE, paper='special',
horizontal=FALSE, height=4, width=5)
par(mar=c(3, 3.25, .25, .5), lwd=1.5, mgp = c(2, 0.45, 0), tcl = -0.4)
x <- seq(0,15,length=100)
plot(x, dchisq(x, 5), ylab='fx', type='l') # fx will be substituted by $f(x)$
text(10, .13, 'ww', adj=0) # LaTeX table will be put at location of ww in graph
dev.off()
x <- cbind(Age=format(c(23.0,9.7)), Sex=c('Male','Female'))
tab <- latexTabular(x, align='rl') # new function in Hmisc
cat('\\psfrag{ww}{\\small', tab, '}',
'\\psfrag{fx}{$f(x)$}',
sep='\n', file='psfrag2_fm')
system('fragmaster.pl psfrag2')
file is attached.