tex: function for use in graphs that are used with the psfrag...

View source: R/tex.s

texR Documentation

function for use in graphs that are used with the psfrag package in LaTeX

Description

tex is a little function to save typing when including TeX commands in graphs that are used with the psfrag package in LaTeX to typeset any LaTeX text inside a postscript graphic. tex surrounds the input character string with ‘⁠\tex[options]{}⁠’. This is especially useful for getting Greek letters and math symbols in postscript graphs. By default tex returns a string with psfrag commands specifying that the string be centered, not rotated, and not specially enlarged or shrunk.

Usage

tex(string, lref='c', psref='c', scale=1, srt=0)

Arguments

string

a character string to be processed by psfrag in LaTeX.

lref

LaTeX reference point for string. See the psfrag documentation referenced below. Default is "c" for centered (this is also the default for psref).

psref

PostScript reference point.

scale

scall factor, default is 1

srt

rotation for string in degrees (default is zero)

Value

tex returns a modified character string.

Author(s)

Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com

References

Grant MC, Carlisle (1998): The PSfrag System, Version 3. Full documentation is obtained by searching www.ctan.org for ‘pfgguide.ps’.

See Also

postscript, par, ps.options, mgp.axis.labels, pdf, trellis.device, setTrellis

Examples

## Not run: 
pdf('test.pdf')
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()
# To process this file in LaTeX do something like
#\documentclass{article}
#\usepackage[scanall]{psfrag}
#\begin{document}
#\begin{figure}
#\includegraphics{test.ps}
#\caption{This is an example}
#\end{figure}
#\end{document}

## End(Not run)

harrelfe/Hmisc documentation built on Nov. 21, 2024, 3:47 p.m.