Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/create_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ create_template <- function(
# customize titlepage tex
if (!file.exists(file_dir, "support_files", "_titlepage.tex") | !is.null(species)) create_titlepage_tex(office = office, subdir = supdir, species = species)
# customize in-header tex
if (!file.exists(file_dir, "support_files", "in-header.tex") | !is.null(species)) create_inheader_tex(species = species, year = year, subdir = supdir)
if (!file.exists(file_dir, "support_files", "in-header.tex") | !is.null(species)) create_inheader_tex(species = species, year = year, subdir = supdir, bib_file = bib_file)
}
} else {
#### Copy template files to report folder ----
Expand All @@ -621,7 +621,7 @@ create_template <- function(
# customize titlepage tex
create_titlepage_tex(office = office, subdir = supdir, species = species)
# customize in-header tex
create_inheader_tex(species = species, year = year, subdir = supdir)
create_inheader_tex(species = species, year = year, subdir = supdir, bib_file = bib_file)
# Copy species image from package
file.copy(spp_image, supdir, overwrite = FALSE) |> suppressWarnings()
# Copy us doc logo
Expand Down Expand Up @@ -677,7 +677,7 @@ create_template <- function(
# customize titlepage tex
create_titlepage_tex(office = office, subdir = supdir, species = species)
# customize in-header tex
create_inheader_tex(species = species, year = year, subdir = supdir)
create_inheader_tex(species = species, year = year, subdir = supdir, bib_file = bib_file)
# Copy species image from package
file.copy(spp_image, supdir, overwrite = FALSE) |> suppressWarnings()
# Copy us doc logo
Expand Down
4 changes: 3 additions & 1 deletion R/utils_tex.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ create_titlepage_tex <- function(office = "",
#' @return Create an in-header latex document that dynamically changes based on
#' the species and year along with other factors.
#' @export
create_inheader_tex <- function(species = NULL, year = NULL, subdir) {
create_inheader_tex <- function(species = NULL, year = NULL, subdir, bib_file = TRUE) {
if (is.null(year)) {
year <- format(as.POSIXct(Sys.Date(), format = "%YYYY-%mm-%dd"), "%Y")
}
Expand All @@ -73,6 +73,7 @@ create_inheader_tex <- function(species = NULL, year = NULL, subdir) {
)
if (is.null(species)) {
to_add <- paste(
{if (isTRUE(bib_file)) "% Link journals package\n\\usepackage{journals-bibnames}\n\n"},
"\\usepackage[headsepline=0.005pt:,footsepline=0.005pt:,plainfootsepline,automark]{scrlayer-scrpage}", "\n",
"\\clearpairofpagestyles", "\n",
"\\ohead[]{\\headmark} \\cofoot[\\pagemark]{\\pagemark}", "\n",
Expand All @@ -85,6 +86,7 @@ create_inheader_tex <- function(species = NULL, year = NULL, subdir) {
lines <- append(lines, to_add)
} else {
to_add <- paste(
{if (isTRUE(bib_file)) "% Link journals package\n\\usepackage{journals-bibnames}\n\n"},
"\\usepackage[headsepline=0.005pt:,footsepline=0.005pt:,plainfootsepline,automark]{scrlayer-scrpage}", "\n",
"\\clearpairofpagestyles", "\n",
"\\ohead[]{\\headmark} \\cofoot[\\pagemark]{\\pagemark}", "\n",
Expand Down
2 changes: 0 additions & 2 deletions inst/resources/formatting_files/in-header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@
% \addtokomafont{subsection}{\subsectionfont}
% \addtokomafont{subsubsection}{\subsubsectionfont}

% Link journals package
\usepackage{journals-bibnames}
Loading