lazy.figure {lazyWeave} | R Documentation |
Include Figures in Latex Documents
Description
Generates the code to place a figure in a Latex document
Usage
lazy.figure(filename, caption = NULL, align = "center", height = 3,
width = 3, units = "in", counter, counterSet = NULL, label = NULL,
placement = "h", alt = "Image Not Found",
cat = getOption("lazyWeave_cat"))
Arguments
filename |
Character string giving the location of the file to be included |
caption |
Text giving the caption for the figure |
align |
Character string stating the alignment. Valid options are
|
height |
The height of the figure |
width |
The width of the figure |
units |
The units for height and width. Defaults to |
counter |
Name of a counter to use to number the table |
counterSet |
The number to which |
label |
Name of a label |
placement |
Controls the placement of the figure. Options are
|
alt |
For HTML documents only–when |
cat |
Logical. Determines if the output is returned as a character string
or returned via the |
Details
For LaTeX files, placement
options are used as follows:
ht | Place the float here, i.e., approximately at the same point it occurs |
t | Position at the top of the page |
b | Position at the bottom of the page |
p | Put on a special page for floats only |
H | Places the float at precisely the location in the LaTeX code. Requires the float package |
The "!"
may be used after any of these in order to override
LaTeX float rules and force your selection. More can be learned by
reading about floats in a LaTeX manual.
For HTML files, the file can be any type supported by the browser. JPEGs and PNGs seem to work well.
Author(s)
Benjamin Nutter
Examples
## Not run:
pdf("MPG.pdf", height=4, width=4)
hist(mtcars$mpg)
dev.off()
lazy.figure("MPG.pdf")
lazy.write(
lazy.file.start(),
lazy.figure("MPG.pdf",
caption="Distribution of Miles per Gallon in mtcars dataset",
height=5, width=5, label="MPGgraph"),
lazy.file.end(),
OutFile="Example-1.tex")
unlink("MPG.pdf")
unlink("Example-1.tex")
unlink("Example-1.pdf")
## End(Not run)