Skip to content

Commit

Permalink
Updates #47. Changing default font to raleway
Browse files Browse the repository at this point in the history
  • Loading branch information
1beb committed Apr 21, 2020
1 parent 8e4ada8 commit 4f53c5d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions R/tex.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ validLatexFont <- function(theme_font) {
# Make sure the theme font is valid; provide a fallback rather than erroring
poss_fonts <- c("bookman","charter","courier","fourier","helvet","lmodern",
"lmr","palatino","tgadventor","tgbonum","tgcursor","tgheros","tgpagella",
"tgschola","tgtermes","times","utopia")
"tgschola","tgtermes","times","utopia", "raleway")

# Raleway is Rawline, YouGov's default font.
if (is.null(theme_font) || !tolower(theme_font) %in% poss_fonts) {
theme_font <- "helvet"
theme_font <- "raleway"
warning("theme$font must be in ", paste0(poss_fonts, collapse = ", "),
". It has been set to `helvet`.", call. = FALSE)
". It has been set to `raleway`.", call. = FALSE)
}
return(theme_font)
}
4 changes: 2 additions & 2 deletions R/theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ themeDefaultExcel <- function(font = getOption("font", default = "Calibri"),
#'
#' \code{themeDefaultLatex} is the default theme. Users can change base options
#'
#' @param font the font to use (default: `"helvet"` for Helvetica)
#' @param font the font to use (default: `"raleway"` for Raleway)
#' @param font_size the font size to use (default: 12)
#'
#' @return A set of theme defaults for use in `writeLatex`
#'
#' @export
themeDefaultLatex <- function(font = getOption("font", default = "helvet"),
themeDefaultLatex <- function(font = getOption("font", default = "raleway"),
font_size = getOption("font_size", default = 12)){

norm <- list(font = font, font_size = NULL)
Expand Down
1 change: 1 addition & 0 deletions R/writeLatex.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ latexDocHead <- function(theme, title, subtitle, banner = NULL) {
paste0("\\fancyhead[L]{{", applyLatexStyle(title, theme$format_title), "}",
applyLatexStyle(subtitle, theme$format_subtitle), "}"),
logo,
"\\setlength{\\headheight}{16pt}", # Issue 47
"\\newcolumntype{d}{D{.}{.}{3.2}}", #!topline
"\\newcolumntype{g}{D{\\%}{\\%}{3.0}}", #!topline #changed 20190907 from 5.0 to 3.0
usepackage("float"), #topline
Expand Down
4 changes: 2 additions & 2 deletions man/themeDefaultLatex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4f53c5d

Please sign in to comment.