Skip to content

Phoenix4815/pandoc_letter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pandoc template for DIN5008 conforming letters

Pull requests welcome! GitHub tag (latest SemVer) License: AGPL v3

This repository provides a simple Pandoc LaTeX template for German DIN5008A and DIN5008B conforming letters. Internally, this template is based on the default Pandoc LaTeX template as well as the scrletter KOMA class.

Example

Also see the examples/ folder.

---
address:
    - An Max Mustermann
    - Fake Street 123
    - 12345 Berlin
    - Deutschland
backaddress:
    - Erika Mustermann
    - Musterhaus 2
    - 99999 Musterstadt
fromaddress:
    - Musterhaus 2
    - 99999 Musterstadt
fromname: Erika Musterfrau
fromemail: example@example.de
opening: Sehr geehrte Damen und Herrren,
closing: Mit freundlichen Grüßen,
encl: Wichtige Dokumente
---

Dies ist ein Testbrief!
*blub*

> Dies ist
> Ein Zitat
 
Test test

Screenshot example letter

Installation

Clone the repository and move the din5008.latex file into the Pandoc template folder.

Windows

The template folder can be found in %USERPROFILE%\AppData\Roaming\pandoc\templates\. Place the din5008.latex there.

Linux

git clone https://github.com/Phoenix4815/pandoc_letter.git /tmp/din5008/
mkdir -p "$HOME/.pandoc/templates/"
cp /tmp/din5008/din5008.latex "$HOME/.pandoc/templates/"

MacOS

The template folder can be found in /Users/USERNAME/.pandoc/templates/. Place the din5008.latex there.

Usage

Create a letter in markdown. See the examples/ folder for a sample letter. Compile using

pandoc --template din5008 YOUR_LETTER.md -o YOUR_LETTER_OUTPUT.pdf

Most options of the default Pandoc LaTeX template should be supported. The following additional variables may be set:

Key Description Default Value
letteroption The scrletter letter type DIN5008B
address Recipient adress required
fromaddress Your address required
specialmail The first three lines in the letter's window according to the DIN standard. Used to e.g. denote "Einschreiben". empty
backaddress Back address in the letter's window empty
fromphone Your phone number empty
fromfax Your fax number empty
fromemail Your email adress empty
yourref "Ihr Zeichen" -
yourmail "Ihr Schreiben vom" -
myref "Unser Zeichen" -
date Date of letter current date
opening The letter's opening required
closing The letter's closing required
ps Post scriptum empty
cc CC empty
encl List of attachments, that will be listed at the end of the letter empty
attachments-duplex If true, insert blank pages in between the letter and all the attachments, such that every document begins on its own sheet of paper false
attachments Append files as attachments to the letter. See the section below empty

Attachments

Currently only PDF-files are supported. For every attachment, the following keys are available:

Key Description Default Value
name Filename/path of the file required
pages Range of pages to be included - (i.e. every page)
options List of further options. See pdfpages here empty

Example code:

encl: [Formular 123, Schein A38]
attachments-duplex: true
attachments:
    - name: formular123.pdf
    - name: A38.pdf
      pages: 1-2, 38
      options: [landscape=true]

Please note that filenames containing underscores are not handled correctly, right now! To still include them, use the following workaround: (Fixed in v1.1.1 ✨)

attachments:
    - name: |
             ```{=latex}
             filename_with_underscores.pdf
             ```