# Don't Edit This:
subobj <- ifelse(exists("subobj"), subobj, FALSE) # create a subobj letter (1a)
newobj <- ifelse(exists("newobj"), newobj, TRUE) # force a new object number (1b-> 2a and 1 -> 2)
cnt_chapt_content<-NMFSReports::auto_counter(cnt_chapt_content)
cnt_equations<-ifelse(newobj, cnt_equations+1, cnt_equations)

if (subobj) {
  # if it contains letters
  if (newobj) {
    cnt_equations_sub <- letters[1]
  } else {
    cnt_equations_sub <- letters[which(letters == 
                                      gsub("[^a-zA-Z]", "", list_equations[length(list_equations)][[1]]$number))+1]
  }
} else {
  cnt_equations_sub <- ""
}

# Systematically save your plot with this function
list_equations<-NMFSReports::save_equations(
  equation = equation, 
  list_equations = list_equations, 
  header = ifelse(exists("header", mode = "character"), header, ""),
  footnote = unlist(ifelse(exists(x = "footnote", mode = "character"), list(footnote), "")), 
  alttext = ifelse(exists("alttext", mode = "character"), alttext, header),
  nickname = ifelse(exists("nickname", mode = "character"), nickname, filename0),
  cnt_chapt_content = ifelse(exists("cnt_chapt_content", mode = "character"), cnt_chapt_content, "001"), 
  cnt = paste0(cnt_equations, cnt_equations_sub), 
)
# make sure you dont mistakenly name other files with these names
remove_who <- c()
remove_who0 <- c("equation", "header", "footnote", "subobj", "newobj", #"nickname", 
                 "alttext")
for (i in 1:length(remove_who0)){
  if(exists(remove_who0[i]) & !exists(remove_who0[i], mode = "function")){
    remove_who <- c(remove_who, remove_who0[i])
  }
}
remove(list = remove_who)

r ifelse(indesign_flowin %in% TRUE, "", list_equations[[length(list_equations)]]$caption)

$$r paste0(list_equations[[length(list_equations)]]$equation)$$

r if(indesign_flowin %in% FALSE & (list_equations[[length(list_equations)]]$alttext)!="") { paste0("*Alternative text: ", list_equations[[length(list_equations)]]$alttext, "*") }



EmilyMarkowitz-NOAA/NMFSReports documentation built on March 26, 2023, 1:08 a.m.