Include Figures in Latex Documents

Share:

Description

Include Figures in Latex Documents

Usage

1
2
3
4
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 "left", "right", or "center"

height

The height of the figure

width

The width of the figure

units

The units for height and width. Defaults to "in".

counter

Name of a counter to use to number the table

counterSet

The number to which counter should be set. In other words, the figure number for this figure

label

Name of a label

placement

Controls the placement of the figure. Options are "ht", "t", "b", "p", "H" and can be supplemented with "!". See "Details" for more explanation

alt

For HTML documents only–when filename cannot be found, this text is printed in the figure's place

cat

Logical. Determines if the output is returned as a character string or returned via the cat function (printed to console). The default value is set by options()$lazyWeave_cat. This argument allows for selective override of the default.

Details

Generates the code to place a figure in a Latex document

Author(s)

Benjamin Nutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.