pretty_captioner: A wrapper for the captioner function

Description Usage Arguments Details Value See Also Examples

Description

A wrapper for the captioner function. This provides captioning functionality via captioner in word, html, and pdf. The wrapper can be used without initialisation, adds a secondary prefix, and an optional inline arguement. It works by intialising a second captioner function which can then be called within the main function. Best practise is to set reinit = TRUE on first using the funciton.

Usage

1
2
3
4
pretty_captioner(label = NULL, caption = NULL, prefix = "Figure",
  sec_prefix = NULL, auto_space = TRUE, levels = 1, type = NULL,
  infix = ".", display = "full", inline = FALSE, reinit = FALSE,
  cap_fun_name = "pretty_cap.cap", ...)

Arguments

label

Character string containing a unique object name.

caption

Character string containing the object caption.

prefix

Character string containing text to go before object number. The default is Figure.

sec_prefix

Character string containing text to between prefix and object number. The default is to add nothing.

auto_space

Logical indicating whether or not a space should automatically be added following the prefix. Space is added by default.

levels

Logical or number indicating whether or not you want hierarchical numbering, and if so, how many levels. Hierarchical numbering is turned off by default.

type

Vector with same length as levels indicating whether figure numbering should be numeric (n), lowercase character (c), or uppercase character (C). If unspecified, captioner will revert to all numeric values.

infix

Character string containing text to go between figure numbers if hierarchical numbering is on. Default is .

display

Character string (logical) indicating what display mode you would like: full (or f) displays all information, cite (or c) displays just the prefix and number, and num (or n) displays just the number.

inline

Logical indicating whether the function should display the prefix uncapitalised/capitalised.

reinit

Logical indicating whether to reinitialise the underlying captioner function.

cap_fun_name

A character string indicating the name to assign to the underlying captioner function.

...

Pass additional arguements to the intialised captioner function

Details

As a wrapper for the captioner function pretty_captioner intialises a captioner function in the global enviroment. This is then used by pretty_captioner to return a character string containing the prefix, sec_prefix, and object number with or without a caption. The initial numbering is determined based on the order of caption creation. However, this order is modified based on the citations you use. The first object to be cited will be moved to the beginning of the list, becoming object 1. Changing captioner parameters (prefix, sec_prefix, auto_space, levels, type, and infix) requires the captioner function to be reinitialised by setting reinit to TRUE. The captioner function can also be initialised without reference to an object by not supplying a label or caption argument. For more details see captioner.

Value

A character string containing the table/figure number, and optionally the caption.

See Also

prettypublisher has a group of related functions which use various defaults: pretty_captioner, pretty_figref, pretty_supfigref, pretty_tabref, and pretty_suptabref.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## First call to pretty_captioner intialising the captioner function
pretty_captioner('1', 'Example caption', reinit = TRUE)

## Second call
pretty_captioner('2', 'Example caption 2')

## Displaying the cite information only for use inline
pretty_captioner('2', display = 'c', inline = TRUE)

## Reference in text without a caption
pretty_captioner('3')

##Changing the prefix, adding a sec_prefix and reinitialising
pretty_captioner('1', 'Example caption 1', prefix = 'Table', sec_prefix = 'S', reinit = TRUE)

seabbs/prettypublisher documentation built on May 30, 2019, 10:36 p.m.