View source: R/new_labelling.R
new_labelling | R Documentation |
These functions return closures that allow for constructing a series of numbered items and to reference them. The number is create the first time a label is encountered, and provided again for further use of the same label.
new_labelling( type = c("arabic", "roman"), string_html = paste0("<style>.++++-%%%%::after{content:\"####\"}</style>", "<span class=\"figheader\">Figure\\ ####: </span>@@@@"), string_latex = "@@@@", string_word = "[Figure\\ ####:]{#++++:%%%%} @@@@", string_ref_html = "<a class=\"++++-%%%%\" href=\"#++++:%%%%\"></a>", string_ref_latex = "\\ref{++++:%%%%}", string_ref_word = "[####](#++++:%%%%)", name = "fig" ) newLabelling( type = c("arabic", "roman"), string_html = paste0("<style>.++++-%%%%::after{content:\"####\"}</style>", "<span class=\"figheader\">Figure\\ ####: </span>@@@@"), string_latex = "@@@@", string_word = "[Figure\\ ####:]{#++++:%%%%} @@@@", string_ref_html = "<a class=\"++++-%%%%\" href=\"#++++:%%%%\"></a>", string_ref_latex = "\\ref{++++:%%%%}", string_ref_word = "[####](#++++:%%%%)", name = "fig" ) fig( caption = "", label = knitr::opts_current$get("label"), ref = NULL, reset = FALSE ) tab( caption = "", label = knitr::opts_current$get("label"), ref = NULL, reset = FALSE ) eq(label, ref, reset = FALSE)
type |
The type of numbering (arabic or roman). |
string_html |
The string prototyping the legend, with |
string_latex |
Idem for LaTeX. |
string_word |
Idem for Word. |
string_ref_html |
Idem for reference in HTML format. |
string_ref_latex |
Idem for reference in LaTeX format. |
string_ref_word |
Idem for reference in Word format. |
name |
The name to use before the number, e.g., "Fig." to get "Fig. 1"
as cross-reference text for the first figure. If you provide |
caption |
The test of the caption. |
label |
A short string uniquely identifying the item within the collection. To set a label in and equation, give a name instead of a string. |
ref |
The reference to the label. |
reset |
If |
A new labelling type is created using new_labelling()
which is a function
factory (a function that creates functions).
The function returns a caption if text =
is provided, or an anchor if it is
missing. If text=
contains a name, it returns a link.
Same for the label=
for eq()
: if it is a text, a couple label + tag to
place inside display equations is produced, and if it is a name, a link is
provided. new_labelling()
creates a new labelling function, which has the
same arguments as fig()
.
Philippe Grosjean
# These function are supposed to be used in an R Markdown document # see the svSweave vignette # Produce a caption that contains the required code to number and reference # a figure in HTML documents fig("A caption", label = "a_label") # Produce a reference to that figure fig$a_label
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.