-
-
Notifications
You must be signed in to change notification settings - Fork 994
Open
Description
rmarkdown/R/latex_dependencies.R
Lines 48 to 59 in ee69d59
| # return the LaTeX dependencies as a string suitable for inclusion | |
| # in the head of a document | |
| latex_dependencies_as_string <- function(dependencies) { | |
| lines <- sapply(dependencies, function(dep) { | |
| opts <- paste(dep$options, collapse = ",") | |
| if (opts != "") opts <- paste0("[", opts, "]") | |
| # \\usepackage[opt1,opt2]{pkgname} | |
| pkg <- paste0("\\usepackage", opts, "{", dep$name, "}") | |
| one_string(c(pkg, dep$extra_lines)) | |
| }) | |
| one_string(unique(lines)) | |
| } |
I wonder if it would be ok to use safer inclusion to avoid potential conflict if this is used in a document where the is already loaded package 🤔
Using \@ifpackageloaded{pkgname}{}{\usepackage[options]{name}}
If a package needs options to be set though, there is not really a good way to avoid option conflict, unless this is loaded before documentclass with \PassOptionsToPackage{options}{pkgname}
Anyhow, I feel latex_dependency is not that much used, and if it would be it need to be safer.
For thoughts...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog