MyNixOS website logo
Description

Simply Beautiful PDF Letters from Markdown.

Write beautiful yet customizable letters in R Markdown and directly obtain the finished PDF. Smooth generation of PDFs is realized by 'rmarkdown', the 'pandoc-letter' template and the 'KOMA-Script' letter class. 'KOMA-Script' provides enhanced replacements for the standard 'LaTeX' classes with emphasis on typography and versatility. 'KOMA-Script' is particularly useful for international writers as it handles various paper formats well, provides layouts for many common window envelope types (e.g. German, US, French, Japanese) and lets you define your own layouts. The package comes with a default letter layout based on 'DIN 5008B'.

komaletter: Simply Beautiful PDF Letters from Markdown

R-CMD-check Package-License CRAN Dependencies 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. Since the layout is fixed, letters can be written perfectly 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 letter layout loosely based on DIN 5008B.

This package is an adaptation of the linl package for international writers. linl itself is based on the pandoc-letter template and extends it for use from R via the rmarkdown package.

Examples

Skeleton

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

Vignette

The vignette examples are a bit more detailed and s demonstrate, for example, how to include a signature, choose a different layout and make some format settings. All of these are driven by simple settings in the YAML header as shown in the following figure on the left.

Usage

To start a new letter you can take advantage of the komaletter skeleton via rmarkdown::draft() or the RStudio menu: File > New File > R Markdown... > From Template > komaletter (PDF). When finished writing your letter the RMarkdown document can be rendered to PDF via rmarkdown::render() or the RStudio Knit button.

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

# change my_letter.Rmd to your liking

# turn Rmd into a beautiful PDF
rmarkdown::render("my_letter.Rmd")

About Printing

Some PDF viewers do not realize that the document already has a blank margin and scale or 'fit to page' for printing. This generally results in smaller fonts, overly large margins, broken layout and most importantly a misplaced address. In the worst case, parts of the address are not visible in the window of the envelope.

komaletter's default layout signals the PDF viewer to print the document at its actual size. Unfortunately, not many PDF viewers heed this hint.

Thus, before printing the document, you should check that the document is not shrunk or 'fit to page'. The document must be printed at its actual size / 100% so that the positions of the elements are correct.

Installation

You can install the released version of komaletter from CRAN with

install.packages("komaletter")

and the development version from GitHub using the package remotes

remotes::install_github("rnuske/komaletter")

Requirements

Beyond the R package dependency rmarkdown, 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. As for LaTeX look for texlive which is included in most Linux distributions. KOMA-Script is part of all but the most bare bone LaTeX distributions. Something like sudo apt install pandoc pandoc-citeproc texlive should provide everything needed on Debian/Ubuntu. To get a working LaTeX on Windows it is recommended to use the service of the R package tinytex.

If you plan to write non-english letters, 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 the underlying Pandoc template.

Metadata

Version

0.5.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows