Code Monkey home page Code Monkey logo

komaletter's Introduction

komaletter: Simple yet flexible Letters via the KOMA-Script LaTeX Bundle

Travis build status Package-License CRAN DOI

Motivation

Simple letters tend to look very much alike. They are either determined by a standard eg. window envelope style or writer's preferences. Thus, if the layout is fix, they lend themselves to be written in R Markdown.

The KOMA-Script LaTeX Bundle provides layouts for many common window envelope types (German, US, French, Japanese, ...) and the possibility to define your own layout. The komaletter package also provides it's own default layout loosely based on DIN 5008B.

This package is an adaptation of the linl package by Dirk Eddelbuettel and Aaron Wolen. Which leans on earlier work by Aaron Wolen in his pandoc-letter repository and extends it for use from R via the rmarkdown package.

Examples

Skeleton

The skeleton creates a very simple letter as a starting point for your own writing. Several formatting defaults for font, fontsize, indentation are in use. See vignette('intro', 'komaletter') and help(komaletter) for a complete list and default values. The following figure shows the complete source on the left and the rendered pdf on the right.

Vignette

The vignette examples are a little more featureful and show how to include a signature, choose a different layout and a few formatting settings. All of these are driven by simple YAML headers as seen on the left. The vignettes also contain a few lines of vignette metadata one would be excluded from a normal letter.

Installation

As the package is on CRAN, you can use the standard incantation to install the released version. A development version of komaletter can be installed from Github using the package devtools.

# the easiest way is to install from CRAN
install.packages("komaletter")

# or get the development version from Github
# install.packages("devtools")
devtools::install_github("rnuske/komaletter")

Usage

To start a new letter one can call the skeleton using the rmarkdown::draft or the RStudio menu: New File > R markdown... The document can be compiled to PDF via rmarkdown::render or the RStudio Knit button.

# load rmarkdown
# komaletter enhances rmarkdown and doesn't need to be loaded
library(rmarkdown)

# start a new letter using the provided skeleton
draft("myletter.Rmd", template="pdf", package="komaletter", edit=FALSE)

# change myletter.Rmd to your liking

# turn Rmd into a beautiful PDF
render("myletter.Rmd")

Requirements

Beyond the R package dependencies, a working pandoc binary and a LaTeX distribution including KOMA-Script is needed. RStudio installs it's own copy of pandoc, otherwise do what is needed on your OS. For LaTeX look for texlive which is included in most Linux distributions or MiKTeX if you are using Windows. KOMA-Script is part of all but the most bare bone LaTeX distributions. Something like sudo apt-get install pandoc pandoc-citeproc texlive should provide everything needed on Debian/Ubuntu.

If you plan to write non-english letter, make sure you have the necessary language packs, i.e texlive-lang-german.

Authors

Robert Nuske, Dirk Eddelbuettel and Aaron Wolen.

License

GPL-3 for this package, the work in pandoc-letter, as well as underlying Pandoc template.

komaletter's People

Contributors

rnuske avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.