Package 'komaletter'

Title: Simply Beautiful PDF Letters from Markdown
Description: 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'.
Authors: Robert Nuske [aut, cre] , Dirk Eddelbuettel [aut] , Aaron Wolen [aut]
Maintainer: Robert Nuske <[email protected]>
License: GPL-3
Version: 0.5.0
Built: 2024-11-07 04:57:27 UTC
Source: https://github.com/rnuske/komaletter

Help Index


KOMA-Script LaTeX Letter Format

Description

A format for LaTeX letters via R Markdown using the KOMA-Script class 'scrlttr2'. It provides layouts for many different window envelope types (German, US, French, Japanese, ...) and lets you define customized layouts.

Usage

komaletter(..., keep_tex = FALSE)

Arguments

...

Additional arguments to rmarkdown::pdf_document()

keep_tex

A boolean toggle to select whether intermediate LaTeX files are to be kept, defaults to FALSE

Value

R Markdown output to pass to rmarkdown::render()

Letter features

Various aspects of the letter can be customized via the following variables in the R Markdown document metadata (aka YAML header).

Although it rarely makes sense to write a letter without sender and recipient, a komaletter can be constructed by merely specifying the output format. All other variables are optional.

Most commonly used variables:

Variable Description
author Writer of the letter.
return-address Address of the sender; takes a list for a multi-line address.
address Name and address of the recipient; takes a list.
date Custom date; if not specified, current date will be inserted.
subject Subject line.
opening Text for the salutation.
closing Text for the complementary close, like: Best regards.
signature Text (e.g. your name) or an image of your signature with "\\includegraphics{sig.png}".
signature-before Adjust vertical space between closing and signature by specifying a length such as ⁠2mm⁠ or "0.5\\baselineskip".

All variables understood by rmarkdown's pdf_document format may be used in addition to the komaletter variables defined in the following table to further customize your letter. For modifications of the layout please refer to the vignette "Introduction to komaletter".

Further variables defined by komaletter:

Variable Description
lco Letter Class Option File. Either name of a standard KOMA-Script LCO (e.g. DIN, SN, ) or path to custom LCO. If not specified, the maintainersDelight.lco will be used.
lang Language code according to BCP 47 (e.g. en or en-GB).
papersize Size of paper eg. a4, letter.
return-phone Phone number of sender used in letter head.
return-email Email address of sender used in letter head.
return-url Website of sender used in letter head.
return-short Shorter version of return address only used in window (see vignette letter_example4).
place Sender’s place used near date.
yourref Addressee’s reference as part of reference line.
yourmail Date of addressee’s referenced mail as part of reference line.
myref Sender’s reference as part of reference line.
customer Customer number as part of reference line.
invoice Invoice number as part of reference line.
cc Recipients to be carbon-copied; can take a list.
encl List of enclosures.
ps Text to be added at the end of the letter as a postscript.
inline-links If true, do standard inline hyperlinks rather than footnotes (styling is author's job, cf. vignette letter_example2).
komaoption Specify further KOMA options; takes a list (see KOMA-Script documentation).
parskip Defines how to mark new paragraphs, e.g. full, half, off (see KOMA-Script documentation).

The source of the example letter vignettes show several of these options in use.

References

JJ Allaire, Yihui Xie, Jonathan McPherson et al. (2020). rmarkdown: Dynamic Documents for R. R package version 2.6. https://cran.r-project.org/package=rmarkdown

Aaron Wolen and Andrew Dunning (2017). pandoc-letter. GitHub Repository. https://github.com/aaronwolen/pandoc-letter

Markus Kohm (2020). KOMA-Script: A versatile LaTeX 2ϵ2_\epsilon bundle. https://komascript.de/~mkohm/scrguien.pdf

Examples

## Not run: 
rmarkdown::draft("my_letter.Rmd", template="pdf", package="komaletter")
rmarkdown::render("my_letter.Rmd")

## End(Not run)