Modifies a LaTeX report file to improve document accessibility. This function automates the process of adding PDF tagging and integrating alternative text for figures and tables.
Usage
add_accessibility(
x = list.files(getwd())[grep("skeleton.tex", list.files(getwd()))],
dir = getwd(),
alttext_csv = file.path(getwd(), "captions_alt_text.csv"),
compile = TRUE,
rename = NULL
)Arguments
- x
.tex The name of the .tex file to modify.
Default: "...skeleton.qmd"
- dir
The directory containing the .tex file.
Default: the working directory (
getwd()).- alttext_csv
Path to the .csv containing alternative text and captions, typically generated by stockplotr::exp_all_figs_tables().
Default: file.path(getwd(), "captions_alt_text.csv")
- compile
Logical. If TRUE, renders the .tex file into a .pdf after modifications are complete.
Default: TRUE
- rename
Optional new name for the modified .tex file (exclude the ".tex" extension). If NULL, the original file is overwritten.
Default: NULL
Details
This function acts as a wrapper for the asar package's accessibility workflow. It first applies document tagging via add_tagging and then injects alternative text using add_alttext.
Examples
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" = "AFSC", "Danny Phantom" = "NWFSC", "Patrick Star" = "SEFSC-ML"),
model_results = output,
model = "SS3",
new_section = "an_additional_section",
section_location = "after-introduction"
)
quarto::quarto_render(file.path(getwd(), "report", "SAR_USWC_Dover_sole_skeleton.qmd"))
add_accessibility(
x = "SAR_USWC_Dover_sole_skeleton.tex",
dir = file.path(getwd(), "report"),
alttext_csv = file.path(getwd(), "captions_alt_text.csv"),
compile = TRUE
)
} # }