-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add alt text to figures; glossary; formatting; R function for local c…
…ompile (#232) * add alt text to all images/figures * add glossary terms * add words to dictionary * add r script to run locally without having to comment out lines yourself * subscript fixes; SB to SSB; equation notation; virgin spawning biomass; unit abbreviations; add mg to glossary
- Loading branch information
1 parent
207cf45
commit c9cbe37
Showing
21 changed files
with
1,000 additions
and
889 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#' Comment out lines that prevent pdf from being generated locally and produce pdf | ||
#' | ||
#' Reads the tex file and comments out lines that prevent pdf from being | ||
#' generated locally and produces pdf using tinytex::pdflatex() and then changes | ||
#' the tex file back. Please see issue #135 in the ss3-doc repository | ||
#' (https://github.com/nmfs-ost/ss3-doc/issues/135) for more information on the | ||
#' lines that prevent the pdf from being generated locally. | ||
#' | ||
#' @param manual_file A string providing the name of the manual tex file. The default is | ||
#' "SS330_User_Manual.tex" with the assumption that this file is in your working directory. | ||
#' @param dir A string providing the path to the directory where `manual_file` is located. | ||
#' The default is [getwd()]. | ||
#' @author Elizabeth F. Perl | ||
#' @return Results from tinytex::pdflatex(). | ||
#' @examples | ||
#' pdflatex_local_manual() | ||
pdflatex_local_manual <- function(manual_file = "SS330_User_Manual.tex", dir = getwd()) | ||
{ | ||
manual <- readLines(file.path(dir,"SS330_User_Manual.tex")) | ||
manual[3] <- gsub("\\\\","%\\\\",manual[3]) | ||
manual[4] <- gsub("\\\\","%\\\\",manual[4]) | ||
manual[6] <- gsub("\\\\","%\\\\",manual[6]) | ||
manual[7] <- gsub("\\\\","%\\\\",manual[7]) | ||
manual[8] <- gsub("\\\\","%\\\\",manual[8]) | ||
manual[9] <- gsub("\\\\","%\\\\",manual[9]) | ||
writeLines(manual, "SS330_User_Manual.tex") | ||
|
||
result <- tryCatch( | ||
expr = { | ||
message(tinytex::pdflatex("SS330_User_Manual.tex")) | ||
message("Successfully created SS330_User_Manual.pdf") | ||
}, | ||
error = function(e){ | ||
message('Caught an error!') | ||
print(e) | ||
}, | ||
warning = function(w){ | ||
message('Caught a warning!') | ||
print(w) | ||
} | ||
) | ||
|
||
manual[3] <- gsub("%\\\\", "\\\\",manual[3]) | ||
manual[4] <- gsub("%\\\\", "\\\\",manual[4]) | ||
manual[6] <- gsub("%\\\\", "\\\\",manual[6]) | ||
manual[7] <- gsub("%\\\\", "\\\\",manual[7]) | ||
manual[8] <- gsub("%\\\\", "\\\\",manual[8]) | ||
manual[9] <- gsub("%\\\\", "\\\\",manual[9]) | ||
writeLines(manual, "SS330_User_Manual.tex") | ||
|
||
return(result) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.