Skip to content

Includes my R package gbtemplate that has a Rmarkdown template called gbtemplate-HTML-and-TeX-knitR which allows you to knit to HTML_document2 and PDF_document2 over bookdown to create TeX files with tikz for the PDF and quickly knitted HTMLs with pngs in it.

Notifications You must be signed in to change notification settings

brueckmann/gbtemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gbtemplate

Includes my R package gbtemplate that is a Rmarkdown template called gbtemplate-HTML-and-TeX-knitR.

This template allows you to knit a Rmd file to HTML_document2 and PDF_document2 over bookdown to knit

a) a PDF with the TeX files where tikz (using tikzDevice) images are used and

b) quickly knitted HTMLs with pngs in it.

Installation

Install in R via pak

pak::pkg_install("brueckmann/gbtemplate")

or devtools

devtools::install_github("brueckmann/gbtemplate")

Usage

The easiest way is probably to go in R Studio click on File -> New File -> R Markdown... –> select From Template and search for: gbtemplate-HTML-and-TeX-knitR {gbtemplate}, see screenshot:

Screenshot from New R Markdown From Template Selection.

This procedure is also explained in the Chapter 17 of the bookdown book.

Next, fill in the fields that show up in the template, with your information.

The template currently offers 4 parameter settings or params:

  • show_code: false

  • debug_mode: true

  • generate_plots: true

  • include_preperation: false

These allow you to show or hide code (aka echo), output warnings and messages (in debug_mode) and to include or exclude some preparatory text and data wrangling (include_preperation) and an option to generate_plots (default) or to remove all plots (not recommended, when you refer to, or more precisely, cross-reference these plots in your text).

You can toggle this over the interface in RStudio or through changing the params from false to true and vice versa.

Select if you want to knit it to PDF (using pdf_document2) or to HTML (using html_document2) in the RStudio interface like this:

Screenshot from RStudio Interface

Why pdf_document2 or html_document2 from bookdown

Using pdf_document2 or html_document2 from the bookdown package allows cross-referencing of Figures and Tables, and these cross-references are also in the LaTeX output.

Read more about this here: https://bookdown.org/yihui/rmarkdown-cookbook/cross-ref.html

Note (of caution)

This is very much work in progress and just one way for me to store this, that's why it is currently version 0.0.1.

Let me know if you discover bugs, etc. Not that I expect anyone to ever use this.

About

Includes my R package gbtemplate that has a Rmarkdown template called gbtemplate-HTML-and-TeX-knitR which allows you to knit to HTML_document2 and PDF_document2 over bookdown to create TeX files with tikz for the PDF and quickly knitted HTMLs with pngs in it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published