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)
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")
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.
r system.file("local_tex", package = "corpident")
to the roots and move it upThe 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.
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")
knitr::knit2pdf( input = sytem.file("demonstrations/poster_demo.Rnw", package = "corpident"), compiler = "xelatex", encoding = "UTF-8" )
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" )
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" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.