Author, typeset, and render LaTeX in R graphics.
latexGrob(tex,
x=0.5, y=0.5,
margin=0, rot=0,
default.units="npc",
hjust="centre", vjust="centre",
width=NA,
dpi=NA,
page=1,
packages=NULL,
engine=getOption("xdvir.engine"),
fontLib=getOption("xdvir.fontLib"),
texFile=NULL,
name=NULL,
gp=gpar(),
vp=NULL)
grid.latex(...)xelatexGrob(tex, ...)
grid.xelatex(...)
lualatexGrob(tex, ...)
grid.lualatex(...)
A "DVIgrob"
object.
LaTeX code as a character vector.
Numeric values or units specifying where to draw the output.
Numeric values or units specifying margins (in the order bottom, left, top, right). Recycled if necessary.
Rotation angle (in degrees).
Units to use if x
or y
are
numeric.
Justification of the output relative to the
x
/y
location.
Either NA
or a numeric value or a unit
specifying the width for typesetting. NA
means the natural width of
tex
.
Resolution (dots per inch) for rendering.
Which page should be drawn.
The LaTeX packages to be used.
May be the name of a LaTeX package (character) or a
"LaTeXpackage"
object.
The TeX engine that should be used to render the LaTeX.
May be the name of a TeX engine (character)
or a "TeXengine"
object.
The font libraary the should be used to query fonts and glyphs.
Character value giving name for the grob.
Graphical parameter settings.
A viewport or NULL
.
Name of a file to use for LaTeX code.
Arguments passed to dviGrob
.
Paul Murrell
grid.latex()
takes a LaTeX fragment, generates a LaTeX
document, typesets it, reads the resulting DVI file and renders the
result.
grid.xelatex()
is just a convenient front end for
grid.latex()
, with appropriate default engine
.
grid.latex()
attempts to be smart about
delaying typesetting until drawing time if necessary in order
to get the correct context for width
and gp
settings.
This means that, unless gp
is set to NULL
and
width
is set to either NA
or an
absolute unit (e.g., a number of inches), the calculation of, for
example, the width of a grob will be less efficient
because the typesetting has to be performed
all over again.
LaTeXpackage
.
if (FALSE) {
# Requires TeX installation
grid.latex("this is a test")
}
Run the code above in your browser using DataLab