library(knitr)
opts_chunk$set(
  echo = FALSE, 
  cache = FALSE, 
  dpi = 300, 
  fig.width = 4.5, 
  fig.height = 2.9, 
  message = FALSE, 
  error = TRUE, 
  warning = FALSE, 
  tidy = FALSE,
  results = "asis"
)
library(pander)

Introduction

The purpose of the corpident package is to demonstrate how to create a package with style files. The table indicates the examples which are currently available in this package.

examples <- data.frame(
  Type = c("Poster", "Report", "Report", "Slides", "Slide handouts"),
  Language = c("LaTeX", "Markdown", "Markdown", "Markdown", "Markdown"),
  Output = c("pdf", "pdf", "html", "pdf", "pdf")
)
pandoc.table(examples, caption = "The currently available examples")

Installation

First install the package in the usual way. The get to current version from GitHub use devtools::install_github("ThierryO/corpident").

All LaTeX based examples require a working LaTeX installation on the machine. They will only run if the Tex Directory Structure (TDS) in the package (r system.file("local_tex", package = "corpident")) is added as a LaTeX root.

MikTeX on Windows

  1. Go to the Start menu --> MikTeX --> Maintance --> Settings
  2. Switch to the 'Roots' tab
  3. Add r system.file("local_tex", package = "corpident") to the roots and move it up
  4. Switch to the 'General' tab
  5. Click the 'Refresh FNDB' button

Updating the package

The package can be updated like any regular package. However, an additiontal step is required when new files are added to the TDS. In such case the file name data base of LaTeX needs to be updated as well.

MikTeX on Windows

  1. Go to the Start menu --> MikTeX --> Maintance --> Settings
  2. Go to the 'General' tab
  3. Click the 'Refresh FNDB' button

Examples

All examples reside in the demonstrations directory of the package.

example.path <- system.file("demonstrations", package = "corpident")
examples <- data.frame(
  File = list.files(example.path, pattern = "(Rnw|Rmd)$")
)
examples$Type <- gsub("^.*\\.", "", examples$File)
pandoc.table(examples, "Example files")

Compiling an Rnw example

knitr::knit2pdf(
  input = sytem.file("demonstrations/poster_demo.Rnw", package = "corpident"),
  compiler = "xelatex", 
  encoding = "UTF-8"
)

Compiling an Rmd example

All defined output formats in the Rmd file

rmarkdown::render(
  input = system.file("demonstrations/rw-FAQ.Rmd", package = "corpident"), 
  output_format = "all", 
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "all", 
  encoding = "UTF-8"
)

A single output format

As defined in the file

rmarkdown::render(
  input = system.file("demonstrations/rw-FAQ.Rmd", package = "corpident"), 
  output_format = "ci_report_pdf", 
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/rw-FAQ.Rmd", package = "corpident"), 
  output_format = "ci_report_html", 
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "ci_slides_pdf", 
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "ci_handouts_pdf", 
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "ci_report_pdf", 
  encoding = "UTF-8"
)

Output format not defined in the file

rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "rmarkdown::word_document",
  encoding = "UTF-8"
)
rmarkdown::render(
  input = system.file("demonstrations/slides_demo.Rmd", package = "corpident"), 
  output_format = "ci_report_html", 
  encoding = "UTF-8"
)


ThierryO/corpident documentation built on May 9, 2019, 4:41 p.m.