setFigCapNumbering: Automatic caption numbering knitr hooks for figures and...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/setFigCapNumbering.R

Description

These function implement ideas by Max Gordon and DeanK (see Details) to add knitr hooks to automate the numbering of figures and tables when generating R Markdown documents.

Usage

1
2
3
4
5
6
7
8
9
setFigCapNumbering(captionName = "fig.cap",
                   figure_counter_str = "Figure %s: ",
                   figureClass = "", imgClass = "",
                   figureInlineStyle = c("display:block"),
                   imgInlineStyle = NULL,
                   optionName = paste0("setCaptionNumbering_", captionName),
                   resetCounterTo = 1)
setTabCapNumbering(table_counter_str = ":Table %s: ",
                   resetCounterTo = 1)

Arguments

captionName

The name of the caption, used in the knitr chunk options to provide the caption text.

figure_counter_str, table_counter_str

The string in which to add the number of the figure or table. The text '%s' will be replaced by the number.

figureClass

Optionally, a css class to pass to the <fig> HTML element that surrounds the <img>.

imgClass

Optionall, a css class to pass to the <img> HTML element.

figureInlineStyle

Any css style to pass to the figure element directly ('inline').

imgInlineStyle

Any css style to pass to the image element directly ('inline').

optionName

The name of the option to use to retrieve and set the counter. This can be used, for example, to have multiple caption types use the same counter.

resetCounterTo

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

Details

The figure caption function is basically the one designed by Max Gordon (see http://gforge.se/2014/01/fast-track-publishing-using-knitr-part-iii/.

The table caption function is an implementation of the ideas of DeanK (see http://stackoverflow.com/questions/15258233/using-table-caption-on-r-markdown-file-using-knitr-to-use-in-pandoc-to-convert-t) combined with Max Gordon's function.

Value

Nothing is returned; the correct hooks are configured for knitr.

Author(s)

Max Gordon (setFigCapNumbering) and DeanK (setTabCapNumbering); implemented by Gjalt-Jorn Peters

Maintainer: Gjalt-Jorn Peters <gjalt-jorn@userfriendlyscience.com>

See Also

knitr

Examples

1
2
3
4
## Not run: 
  setFigCapNumbering("This is figure number %s, with caption text: ");

## End(Not run)

userfriendlyscience documentation built on May 2, 2019, 1:09 p.m.