Skip to content

Commit

Permalink
Merge pull request #51 from inbo/extra_templates
Browse files Browse the repository at this point in the history
Extra templates
  • Loading branch information
ThierryO committed Jul 19, 2019
2 parents e4c2304 + a85f759 commit 3d568c6
Show file tree
Hide file tree
Showing 60 changed files with 345 additions and 134 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: INBOmd
Type: Package
Title: Markdown Templates for INBO
Version: 0.4.5
Date: 2019-06-11
Version: 0.4.6
Date: 2019-07-19
Authors@R: c(
person("Thierry", "Onkelinx", email = "thierry.onkelinx@inbo.be", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8804-4216")),
person("Floris", "Vanderhaeghe", email = "floris.vanderhaeghe@inbo.be", role = c("ctb"), comment = c(ORCID = "0000-0002-6378-6229")),
Expand Down
23 changes: 23 additions & 0 deletions NEWS.md
@@ -1,3 +1,26 @@
# INBOmd 0.4.6 (2018-07-19)

- slides gains a logo argument
- add report templates with Flemish corporate identity in Dutch and English
- update Flanders Art font

# INBOmd 0.4.5 (2018-06-12)

- `inbo_rapport()` gains a `tocdepth` argument
- updated installation instructions

# INBOmd 0.4.4 (2018-03-12)

- INBO theme for English presentation

# INBOmd 0.4.3 (2018-12-18)

- add `inbo_poster()`
- add `inbo_report_css()`
- add report template for gitbook
- import report template for pdf
- create addins for RStudio

# INBOmd 0.4.2 (2018-04-10)

- `inbo_rapport()` gains a `flandersfont` argument
Expand Down
62 changes: 39 additions & 23 deletions R/inbo_rapport.R
@@ -1,25 +1,32 @@
#' Create a report with the INBO theme version 2015
#' @param subtitle An optional subtitle
#' @param reportnr The report number
#' @param ordernr The order number
#' @param floatbarrier Should float barriers be placed? Defaults to NA (no extra float barriers). Options are "section", "subsection" and "subsubsection".
#' @param lang The language of the document. Defaults to "english, french, dutch". The last language is the main language.
#' Create a report with the Flemish corporate identity
#' @param subtitle An optional subtitle.
#' @param reportnr The report number.
#' Defaults to the date and time of compilation.
#' @param ordernr The optional order number.
#' @param floatbarrier Should float barriers be placed?
#' Defaults to NA (only float barriers before starting a new chapter `#`).
#' Options are "section" (`##`), "subsection" (`###`) and "subsubsection" (`####`).
#' @param style What template to use.
#' Use "INBO" for an INBO report in Dutch.
#' Use "Vlaanderen" for a report in Dutch written by more than one Flemish government agency.
#' Use "Flanders" for a report in English.
#' @param fig_crop \code{TRUE} to automatically apply the \code{pdfcrop} utility
#' (if available) to pdf figures
#' (if available) to pdf figures.
#' @param pandoc_args Additional command line options to pass to pandoc
#' @inheritParams inbo_slides
#' @inheritParams rmarkdown::pdf_document
#' @param ... extra parameters: see details
#'
#' @details
#' Available extra parameters:
#' \itemize{
#' \item lof: display a list of figures. Defaults to TRUE
#' \item lot: display a list of tables. Defaults to TRUE
#' \item hyphenation: the correct hyphenation for certain words
#' \item flandersfont: Use the Flanders Art Sans font on title page? Defaults to FALSE. Note that this requires the font to be present on the system.
#' \item tocdepth: which level headers to display. 0: upto chapters (`#`), 1: upto section (`##`), 2: upto subsection (`###`), 3: upto subsubsection (`####`). Defaults to 3.
#' }
#' - `lof`: display a list of figures. Defaults to TRUE
#' - `lot`: display a list of tables. Defaults to TRUE
#' - `tocdepth`: which level headers to display.
#' - 0: upto chapters (`#`)
#' - 1: upto section (`##`)
#' - 2: upto subsection (`###`)
#' - 3: upto subsubsection (`####`) default
#' - `hyphenation`: the correct hyphenation for certain words.
#' @export
#' @importFrom rmarkdown output_format knitr_options pandoc_options pandoc_variable_arg includes_to_pandoc_args pandoc_version
#' @importFrom utils compareVersion
Expand All @@ -30,7 +37,7 @@ inbo_rapport <- function(
ordernr,
floatbarrier = c(NA, "section", "subsection", "subsubsection"),
codesize = c("footnotesize", "scriptsize", "tiny", "small", "normalsize"),
lang = "english, french, dutch",
style = c("INBO", "Vlaanderen", "Flanders"),
keep_tex = FALSE,
fig_crop = TRUE,
citation_package = c("natbib", "none"),
Expand All @@ -40,6 +47,7 @@ inbo_rapport <- function(
){
check_dependencies()
floatbarrier <- match.arg(floatbarrier)
style <- match.arg(style)
extra <- list(...)
codesize <- match.arg(codesize)

Expand All @@ -50,7 +58,21 @@ inbo_rapport <- function(
"--template", template,
pandoc_variable_arg("documentclass", "report"),
pandoc_variable_arg("codesize", codesize),
pandoc_variable_arg("mylanguage", lang)
switch(
style,
Flanders = c(
pandoc_variable_arg("style", "flanders_report"),
pandoc_variable_arg("mylanguage", "french,dutch,english")
),
Vlaanderen = c(
pandoc_variable_arg("style", "vlaanderen_report"),
pandoc_variable_arg("mylanguage", "french,english,dutch")
),
INBO = c(
pandoc_variable_arg("style", "inbo_report"),
pandoc_variable_arg("mylanguage", "french,english,dutch")
)
)
)
if (compareVersion(as.character(pandoc_version()), "2") < 0) {
args <- c(args, "--latex-engine", "xelatex", pandoc_args) #nocov
Expand Down Expand Up @@ -83,9 +105,6 @@ inbo_rapport <- function(
if (!"lot" %in% names(extra)) {
extra$lot <- TRUE
}
if (!"flandersfont" %in% names(extra)) {
extra$flandersfont <- FALSE
}
if (extra$lof) {
args <- c(args, pandoc_variable_arg("lof", TRUE))
}
Expand All @@ -95,10 +114,7 @@ inbo_rapport <- function(
if (extra$lof || extra$lot) {
args <- c(args, pandoc_variable_arg("loft", TRUE))
}
if (extra$flandersfont) {
args <- c(args, pandoc_variable_arg("flandersfont", TRUE))
}
extra <- extra[!names(extra) %in% c("lof", "lot", "flandersfont")]
extra <- extra[!names(extra) %in% c("lof", "lot")]
if (length(extra) > 0) {
args <- c(
args,
Expand Down
6 changes: 6 additions & 0 deletions R/inbo_slides.R
Expand Up @@ -17,6 +17,7 @@
#' @param website An optional URL to display on the left sidebar. Defaults to www.INBO.be.
#' @param theme The theme to use. Available options are "inbo" and "vlaanderen"
#' @param flandersfont If TRUE use the Flanders Art font. If FALSE use Calibri. Defaults to FALSE.
#' @param slide_logo the path to an optional logo displayed on each slide
#' @param ... extra parameters
#' @inheritParams rmarkdown::pdf_document
#' @export
Expand All @@ -32,6 +33,7 @@ inbo_slides <- function(
cover_offset,
cover_hoffset,
cover_horizontal = TRUE,
slide_logo,
toc_name,
fontsize,
codesize = c("footnotesize", "scriptsize", "tiny", "small", "normalsize"),
Expand Down Expand Up @@ -121,6 +123,10 @@ inbo_slides <- function(
args <- c(args, pandoc_variable_arg("coverhorizontal", cover_horizontal))
}
}
if (!missing(slide_logo)) {
assert_that(is.string(slide_logo))
args <- c(args, pandoc_variable_arg("slidelogo", slide_logo))
}
output_format(
knitr = knitr_options(
opts_knit = list(
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -31,6 +31,7 @@ Below are some documents created with INBOmd
INBOmd requires a working installation of XeLaTeX. We highly recommend to use the TinyTeX. Close all open R sessions and start a fresh R session. Execute the commands below. This will install TinyTeX on your machine. No admin rights are required. Although TinyTeX is a lightweight installation, it still is several 100 MB large.

```{r eval = FALSE}
update.packages(ask = FALSE, checkBuilt = TRUE)
if (!"tinytex" %in% rownames(installed.packages())) {
install.packages("tinytex")
tinytex::install_tinytex()
Expand All @@ -43,7 +44,7 @@ Once TinyTeX is installed, you need to restart RStudio. Then you can proceed wit
if (!"remotes" %in% rownames(installed.packages())) {
install.packages("remotes")
}
remotes::install_github("inbo/INBOmd", dependencies = TRUE)
remotes::install_github("inbo/INBOmd", dependencies = TRUE, upgrade = FALSE)
tinytex::tlmgr_install(c(
'inconsolata', 'times', 'tex', 'helvetic', 'dvips'
))
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Expand Up @@ -78,16 +78,14 @@
\expandafter\ifstrequal\custom{TRUE}{
\setmainfont[
Ligatures = TeX,
ItalicFont = FlandersArtSans-Light.ttf,
ItalicFeatures = {FakeSlant = 0.15},
BoldFont = FlandersArtSans-Medium.ttf,
BoldItalicFont = FlandersArtSans-Medium.ttf,
BoldItalicFeatures = {FakeSlant = 0.15}
]{FlandersArtSans-Regular.ttf}
ItalicFont = FlandersArtSans-Italic,
BoldFont = FlandersArtSans-Bold,
BoldItalicFont = FlandersArtSans-BoldItalic,
]{FlandersArtSans-Regular.otf}
}{
\setmainfont[
Ligatures = TeX
]{Calibri.ttf}
]{Calibri}
}
}

Expand Down
Expand Up @@ -19,6 +19,7 @@
\coveroffset{0mm}
\coverhoffset{0mm}
\website{www.INBO.be}
\slidelogo{}

\RequirePackage{inboimage_2015}

Expand Down
Expand Up @@ -14,16 +14,14 @@
\expandafter\ifstrequal\custom{TRUE}{
\setmainfont[
Ligatures = TeX,
ItalicFont = FlandersArtSans-Light.ttf,
ItalicFeatures = {FakeSlant = 0.15},
BoldFont = FlandersArtSans-Medium.ttf,
BoldItalicFont = FlandersArtSans-Medium.ttf,
BoldItalicFeatures = {FakeSlant = 0.15}
]{FlandersArtSans-Regular.ttf}
ItalicFont = FlandersArtSans-Italic,
BoldFont = FlandersArtSans-Bold,
BoldItalicFont = FlandersArtSans-BoldItalic,
]{FlandersArtSans-Regular.otf}
}{
\setmainfont[
Ligatures = TeX
]{Calibri.ttf}
]{Calibri}
}
}

Expand Down
Expand Up @@ -17,6 +17,8 @@
\def\website#1{\def\@website{#1}}
\def\flandersfont#1{\def\@flandersfont{#1}}
\flandersfont{FALSE}
\def\slidelogo#1{\def\@slidelogo{#1}}
\slidelogo{}

\RequirePackage[absolute, overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
Expand All @@ -36,6 +38,24 @@
}%
}

\newcommand{\showslidelogo}[1]{%
\protected@edef\@tempa{#1}%
\expandafter\notblank\expandafter{\@tempa}
{%
\pgfdeclareimage[height = 9.9mm, interpolate = true]{customlogo}{#1}
\pgfuseimage{customlogo}
}{}%
}

\newcommand{\showtitlelogo}[1]{%
\protected@edef\@tempa{#1}%
\expandafter\notblank\expandafter{\@tempa}
{%
\pgfdeclareimage[height = 20mm, interpolate = true]{customtitlelogo}{#1}
\pgfuseimage{customtitlelogo}
}{}
}

\RequirePackage{inboimage_2015}

% define font sizes
Expand Down
Expand Up @@ -74,7 +74,11 @@
\end{pgftranslate}
\end{textblock}

\begin{textblock}{3.5}(0, 0)
\begin{textblock}{114.5}(3.5, 66)
\hfill \showtitlelogo{\@slidelogo}%
\end{textblock}

\begin{textblock}{3.5}(0, 0)
\begin{pgfpicture}{0cm}{0cm}{3.5mm}{96mm}
\color{main.colour}
\pgfrect[fill]{\pgfpoint{0mm}{0mm}}{\pgfpoint{3.5mm}{96mm}}
Expand Down Expand Up @@ -115,6 +119,8 @@

\setbeamertemplate{sidebar left}{
\sidebarlogo
\hfill
\showslidelogo{\@slidelogo}

\begin{textblock}{4}(0, 0)
\begin{pgfpicture}{0cm}{0cm}{3.5mm}{96mm}
Expand Down
28 changes: 28 additions & 0 deletions inst/local_tex/tex/latex/inbogeneric_2015/flanderscolours.sty
@@ -0,0 +1,28 @@
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{inbocolours_2015}

% definition of INBO colours
\RequirePackage{xcolor}
\definecolor{main.colour}{RGB}{0, 0, 0}
\definecolor{link.colour}{RGB}{240, 215, 15}
\definecolor{sectiontitle.colour}{RGB}{255, 255, 255}
\definecolor{frametitle.colour}{RGB}{192, 67, 132}
\definecolor{support.colour}{RGB}{192, 67, 132}
\definecolor{box.colour.title}{RGB}{0, 0, 0}
\definecolor{box.colour.body}{RGB}{229, 229, 229}
\definecolor{box.colour}{RGB}{213, 213, 213}
\definecolor{box.colour.fg}{RGB}{0, 0, 0}
\definecolor{example.colour.title}{RGB}{0, 0, 0}
\definecolor{example.colour.body}{RGB}{68, 196, 110}
\definecolor{example.colour}{RGB}{111, 139, 0}
\definecolor{example.colour.fg}{RGB}{0, 0, 0}
\definecolor{alert.colour.title}{RGB}{255, 255, 255}
\definecolor{alert.colour.body}{RGB}{192, 67, 132}
\definecolor{alert.colour}{RGB}{213, 62, 94}
\definecolor{alert.colour.fg}{RGB}{255, 255, 255}
\definecolor{warning.colour}{RGB}{178, 50, 70}
\definecolor{highlight.colour}{RGB}{179, 94, 32}
\definecolor{shadecolor}{gray}{.95}
\definecolor{number.colour}{RGB}{50, 178, 233}
\definecolor{comment.colour}{RGB}{21, 70, 91}
Binary file removed inst/local_tex/tex/latex/inboimage_2015/alert.png
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
39 changes: 39 additions & 0 deletions inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty
@@ -0,0 +1,39 @@
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{flanders_report}

\RequirePackage{flanders_report_generic}
\alertlogo{alert_black.png}

% definition of colour scheme
\RequirePackage{flanderscolours}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Page \textbf{\thepage} of \textbf{\pageref*{LastPage}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@reportnumber}}
\renewcommand{\footrule}{\vbox to 8pt{\hbox
to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\fancypagestyle{plain}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@reportnumber}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Page \textbf{\thepage} of \textbf{\pageref*{LastPage}}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}

\fancypagestyle{cover}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[L]{\includegraphics[height = 10mm, keepaspectratio]{vlaanderen_en_naakt}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\footrule}{\vbox to 0pt{\hbox
to\headwidth{\hbox{}\hfill}\vss}}
\setlength{\footskip}{30pt}
}

0 comments on commit 3d568c6

Please sign in to comment.