insertfigure: Function to insert a figure and format the caption when using...

View source: R/insertfigure.R

insertfigureR Documentation

Function to insert a figure and format the caption when using pandoc-crossref.

Description

Formats the caption according to the output format. For the short caption, you need this Lua Filter: https://github.com/pandoc/lua-filters/tree/master/short-captions The function EZfigure() is a wrapper function for insertfigure(..., label = knitr::opts_current$get("label"), path = knitr::fig_chunk(knitr::opts_current$get("label"), ext = "png"), unlisted = FALSE, ext = "png", auto_pdf = TRUE). By default, the file path from the previous chunk is used.

Usage

insertfigure(
  path,
  caption,
  label = NULL,
  shortcaption = NULL,
  unlisted = FALSE,
  ext = "png",
  auto_pdf = getOption("knitr.graphics.auto_pdf", FALSE)
)

EZfigure(caption, shortcaption = NULL)

Arguments

path

Full path to the image file (with extension), default is the path to the figure of the last chunk

caption

A character vector containing the (long) caption of the figure.

label

An optional character vector containing the label used for referencing.

shortcaption

An optional character vector containing the short caption.

unlisted

Either TRUE or FALSE, to determine if the figure should be added to the list of figures

ext

The file extension, defaults to "png"

auto_pdf

Whether to use PDF images automatically when the output format is LaTeX. If TRUE, then e.g. foo/bar.png will be replaced by foo/bar.pdf if the latter exists. This can be useful since normally PDF images are of higher quality than raster images like PNG, when the output is LaTeX/PDF.

Value

Command to insert a figure in Markdown


julianre/jRmisc documentation built on June 4, 2024, 11:32 p.m.