Systematically save your figures for your report

save_equations(
  equation,
  list_equations,
  header = "",
  footnote = "",
  cnt_chapt_content = "001",
  cnt = 1,
  type = "Equation",
  alttext = "",
  nickname = "",
  message = FALSE
)

Arguments

equation

The latex equation you would like to be saved.

list_equations

The list where all equations will be saved.

header

The name and title of the figure. Default = "".

footnote

Any footnote you want attached to this figure.

cnt_chapt_content

The order number that this exists in the chapter.

cnt

The figure number.

type

Default = "Equation", but can be anything that the element needs to be called (e.g., "Eq.", "Equ.") to fit in the phrase "Equation 1. This is my equation!".

alttext

String with what the alternative text is.

nickname

A unique name that can be used to identify the figure so it can be referenced later in the report.

message

TRUE/FALSE. Default = FALSE. If TRUE, it will print information about where your plot has been saved to.

Value

list_equations updated with the new equation and metadata.

Examples

list_equations  <- c()
cnt_eq <- 0

cnt_eq<-NMFSReports::auto_counter(cnt_eq)
list_equations <-NMFSReports::save_equations(
   equation = "$$c^2 = b^2 + a^2$$",
   cnt = cnt_eq,
   list_equations  = list_equations ,
   nickname = "pythagorean",
   header = "Pythagorean theorem",
   footnote = "footnote about how cool the pythagorean theorem is.",
   alttext = "The Pythagoras theorem is a mathematical law.")

cnt_eq<-NMFSReports::auto_counter(cnt_eq)
list_equations <-NMFSReports::save_equations(
   equation = "$$F = G \frac{m_1 m_2}{d^2}$$",
   cnt = cnt_eq,
   list_equations  = list_equations ,
   nickname = "Newton",
   header = "Newton's Universal Law of Gravitation")

names(list_equations )
#> [1] "pythagorean" "Newton"     
list_equations
#> $pythagorean
#> $pythagorean$equation
#> [1] "$$c^2 = b^2 + a^2$$"
#> 
#> $pythagorean$caption
#> [1] "Equation [1](){#pythagorean}. Pythagorean theorem.^[footnote about how cool the pythagorean theorem is.]"
#> 
#> $pythagorean$header
#> [1] "Equation [1](){#pythagorean}. Pythagorean theorem."
#> 
#> $pythagorean$nickname
#> [1] "pythagorean"
#> 
#> $pythagorean$alttext
#> [1] "The Pythagoras theorem is a mathematical law."
#> 
#> $pythagorean$number
#> [1] "1"
#> 
#> $pythagorean$footnote
#> [1] "footnote about how cool the pythagorean theorem is."
#> 
#> 
#> $Newton
#> $Newton$equation
#> [1] "$$F = G \frac{m_1 m_2}{d^2}$$"
#> 
#> $Newton$caption
#> [1] "Equation [2](){#Newton}. Newton's Universal Law of Gravitation."
#> 
#> $Newton$header
#> [1] "Equation [2](){#Newton}. Newton's Universal Law of Gravitation."
#> 
#> $Newton$nickname
#> [1] "Newton"
#> 
#> $Newton$alttext
#> [1] ""
#> 
#> $Newton$number
#> [1] "2"
#> 
#> $Newton$footnote
#> [1] ""
#> 
#>