| insertFigureCaption {ufs} | R Documentation |
Insert numbered caption
Description
These functions can be used to manually insert a numbered caption. These
functions have been designed to work well with setFigCapNumbering() and
setTabCapNumbering(). This is useful when
inserting figures or tables in an RMarkdown document when you
use automatic caption numbering for knitr chunks, but are inserting a
table or figure that isn't produced in a knitr chunk while
still retaining the automatic numbering. insertNumberedCaption() is the
general-purpose function; you will typically only use insertFigureCaption()
and insertTableCaption().
Usage
insertFigureCaption(
captionText = "",
captionName = "fig.cap",
prefix = getOption(paste0(optionName, "_prefix"), "Figure %s: "),
suffix = getOption(paste0(optionName, "_suffix"), ""),
optionName = paste0("setCaptionNumbering_", captionName),
resetCounterTo = NULL
)
insertNumberedCaption(
captionText = "",
captionName = "fig.cap",
prefix = getOption(paste0(optionName, "_prefix"), "Figure %s: "),
suffix = getOption(paste0(optionName, "_suffix"), ""),
optionName = paste0("setCaptionNumbering_", captionName),
resetCounterTo = NULL
)
insertTableCaption(
captionText = "",
captionName = "tab.cap",
prefix = getOption(paste0(optionName, "_prefix"), "Table %s: "),
suffix = getOption(paste0(optionName, "_suffix"), ""),
optionName = paste0("setCaptionNumbering_", captionName),
resetCounterTo = NULL
)
Arguments
captionText |
The text of the caption. |
captionName |
The name of the caption; by default, for tables,
" |
prefix, suffix |
The prefix and suffix texts; |
optionName |
The name of the option to use to save the number counter. |
resetCounterTo |
If a numeric value, the counter is reset to that value. |
Value
The caption in a character vector.
Examples
insertNumberedCaption("First caption");
insertNumberedCaption("Second caption");
sectionNumber <- 12;
insertNumberedCaption("Third caption",
prefix = paste0("Table ",
sectionNumber,
".%s: "));