Add alternative text into latex
add_alttext(
x = list.files(getwd())[grep("skeleton.tex", list.files(getwd()))],
dir = getwd(),
rda_dir = getwd(),
alttext_csv_dir = getwd(),
compile = TRUE,
rename = NULL
)
.tex file containing report. Typically produced after initially rendering the skeleton made from create_template.
directory where the tex file is located that will be edited
folder where rda files containing alternative text is located
Directory for the csv file containing alternative text and captions generated when running satf::exp_all_figs_tables
Indicate whether the document (X) should be rendered after these files are changed. Default TRUE.
Indicate a name for the new tex file produced from this function. There is no need to include ".tex" in the name. Defaults to current name and overwrites the current tex file.
This function was made to help add in
alternative text to latex documents generated from
quarto. Quarto does not currently contain a way to
add alternative text to PDF documents, so this function
was developed as a work around. The addition of alternative
text needs to be found in either the rda files produced from
stockplotr::exp_all_figs_tables or in the captions_alt_text.csv also produced from
the same function. Users not using this format should create a csv file with
columns containing "label" and "alt_text" where the label column contains the
exact label name when referencing the image/figure in text. The label is
very important as it provides a way for the function to match where the
alternative text gets placed. When compile is set to TRUE, the alternative
text using this format will not be available and must be used in conjunction
with asar::add_tagging()
.
if (FALSE) { # \dontrun{
create_template(
new_template = TRUE,
format = "pdf",
office = "NWFSC",
region = "U.S. West Coast",
species = "Dover sole",
spp_latin = "Microstomus pacificus",
year = 2010,
author = c("John Snow", "Danny Phantom", "Patrick Star"),
include_affiliation = TRUE,
convert_output = TRUE,
resdir = "C:/Users/Documents/Example_Files",
model_results = "Report.sso",
model = "SS3",
new_section = "an_additional_section",
section_location = "after-introduction",
rda_dir = getwd()
)
path <- getwd()
quarto::quarto_render(file.path(path, "report", "SAR_USWC_Dover_sole_skeleton.qmd"))
withr::with_dir(
file.path(path, "report"),
add_alttext(
x = "SAR_USWC_Dover_sole_skeleton.tex",
dir = getwd(),
alttext_csv_dir = getwd(),
rda_dir = path,
compile = FALSE,
rename = "SAR_Dover_sole_tagged")
)
} # }