crossref | R Documentation |
Reference a figure, table, or equation with an anchored tag
crossref(list_obj, nickname, sublist = "number", exact = TRUE, text = TRUE)
list_obj |
A list object created by list_figures or list_tables. |
nickname |
A unique string that is used to identify the plot or table in list_figures or list_tables, respectively. |
sublist |
A string of the sublist in list_figures or list_tables you want the contents returned from. |
exact |
T/F. If TRUE, 'nickname' must match the name of the list item exactly. If FALSE, crossref will return all entries with that string fragment. Default = TRUE. |
text |
T/F. If TRUE, will output results prepared for a text output. If FALSE, will output each element. Default = TRUE. |
The item in the list.
list_figures <- c()
table_raw <- data.frame(x = 1, y = 1)
pp <- plot(x = table_raw$x, y = table_raw$y)
list_figures <- NMFSReports::save_figures(
figure = pp,
list_figures = list_figures,
header = "blah blah blah",
nickname = "example_1", # a unique name you can refer back to
cnt_chapt_content = "003",
cnt = "012")
list_figures <- NMFSReports::save_figures(
figure = pp,
list_figures = list_figures,
header = "blah blah blah",
nickname = "example2", # a unique name you can refer back to
cnt_chapt_content = "003",
cnt = "013")
list_figures
refnum <- crossref(
list_obj = list_figures,
nickname = "example_1",
sublist = "number")
refnum
print(paste0("Please refer to figure ", refnum,
" to see this figure, not the other figure."))
# example using a partial phrase with `exact = FALSE`
crossref(
list_obj = list_figures,
nickname = "example_",
sublist = "number",
exact = FALSE)
# using a wildard with `exact = FALSE`
crossref(
list_obj = list_figures,
nickname = "example*1",
sublist = "number",
exact = FALSE)
crossref(
list_obj = list_figures,
nickname = "example*",
sublist = "number",
exact = FALSE,
text = FALSE)
refnum <- crossref(
list_obj = list_figures,
nickname = "example*",
sublist = "number",
exact = FALSE,
text = TRUE)
refnum
print(paste0("Please refer to figure ", refnum,
" to see this figure, not the other figure."))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.