Learn R Programming

ufs (version 0.5.12)

setCaptionNumberingKnitrHook: Set a knitr hook for caption numbering

Description

Set a knitr hook to automatically number captions for, e.g., figures and tables. setCaptionNumberingKnitrHook() is the general purpose function; you normally use setFigCapNumbering() or setTabCapNumbering().

Usage

setCaptionNumberingKnitrHook(
  captionName = "fig.cap",
  prefix = "Figure %s: ",
  suffix = "",
  optionName = paste0("setCaptionNumbering_", captionName),
  resetCounterTo = 1
)

setFigCapNumbering( captionName = "fig.cap", prefix = "Figure %s: ", suffix = "", optionName = paste0("setCaptionNumbering_", captionName), resetCounterTo = 1 )

setTabCapNumbering( captionName = "tab.cap", prefix = "Table %s: ", suffix = "", optionName = paste0("setCaptionNumbering_", captionName), resetCounterTo = 1 )

Value

NULL, invisibly.

Arguments

captionName

The name of the caption; for example, fig.cap or tab.cap.

prefix, suffix

The prefix and suffix; any occurrences of \%s will be replaced by the number.

optionName

THe name to use for the option that keeps track of the numbering.

resetCounterTo

Whether to reset the counter (as stored in the options), and if so, to what value (set to FALSE to prevent resetting).

Examples

Run this code
### To start automatically numbering figure captions
setFigCapNumbering();

### To start automatically numbering table captions
setTabCapNumbering();

Run the code above in your browser using DataLab