setCaptionNumbering

Convenience function for numbered captions in knitr (and so, RMarkdown)

This function makes it easy to tell knitr (and so RMarkdown) to use numbered captions of any type.

Keywords
utils
Usage
setCaptionNumbering(captionName = "tab.cap",
                    prefix = ":Table %s: ",
                    suffix = "",
                    captionBefore = FALSE,
                    romanNumeralSetting = "counter_roman",
                    resetCounterTo = 1)
Arguments
captionName

The name of the caption; this is used both as unique identifier for the counter, and to set the caption text (included between the prefix and suffix) in the chunk options.

prefix

The text to add as prefix before the action caption; this will typically include '%s%' which will be replaced by the number of this caption.

suffix

The text to add as suffix after the action caption; this can also include '%s%' which will be replaced by the number of this caption. Together with the prefix, this can also be used to enclose the caption in html.

captionBefore

Whether the caption should appear before or after the relevant chunk output.

romanNumeralSetting

The name of the option (should be retrievable with getOption) where it's configured whether to use Roman (TRUE) or Latin (FALSE) numerals. FALSE is assumed if this option isn't set.

resetCounterTo

If not NULL and numeric, the counter will start at this number.

Value

This function returns nothing, but instead sets the appropriate knit_hooks. Or rather, just one hook.

Aliases
  • setCaptionNumbering
Examples
# NOT RUN {
  setCaptionNumbering(captionName='tab.cap',
                      prefix = ":Table %s: ");
# }
Documentation reproduced from package userfriendlyscience, version 0.6-1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.