pandoc: Add German letter template

This commit is contained in:
Nils Freydank 2020-09-07 23:47:27 +02:00
parent 862bd52f5d
commit dedaef9a8e
No known key found for this signature in database
GPG Key ID: BC5DC2998AAD2B21

126
pandoc/Brief-DIN-5008.latex Normal file
View File

@ -0,0 +1,126 @@
% -----------------------------------------
% This LaTeX file is a pandoc template for
% letters in German language according to
% DIN 5008/2011.
%
% Copyright (C) 2020 by Nils Freydank,
% <nils.freydank@posteo.de>
% License: GPL-2
% see COPYING-GPL-2 file.
%
% Note that this template should be used with lualatex, e.g. as
% pandoc --standalone --template="Brief-DIN-5008" --pdf-engine=lualatex \
% Brief.md -o Brief.pdf
% and use the following example for your markdown headers:
%
% cat << EOF > Brief.md
% ---
% Schriftgröße: 12pt
% Absender: Max Mustermann
% Telefonnummer: +49 0123 456789
% E-Mail-Adresse: no.spam@me.de
% Datum: 1. Januar 1970
% Ort: zu Hause
% Titel: ganz große Überschrift, mittig
% Betreff: Ein ganz wichtiger Brief
% Absenderadresse:
% - Straße 1
% - 12345 Nirgendwo
% Empfängeranschrift:
% - Empfänger meiner Post
% - Straße 2
% - 12345 Nirgendwo
% Anlagen:
% Anrede: Sehr geehrte Damen und Herren,
% Grußformel: Mit freundlichen Grüßen
% PS: Pandoc rulez!
% ---
% wie telefonisch besprochen sende ich Ihnen hiermit einen Brief.
% EOF
% ----------------------------------------- %
\documentclass[
fontsize=$Schriftgröße$,
paper=a4,
backaddress=line, % draw a thin line under the back address
firstfoot=false, % throw one of the two spaces away
fromalign=left, % position the letter header left|center|right
fromemail=true, % show the email address
fromlogo=false, % show the logo in letter hea
foldmarks=true, % enable foldmarks at the left side
foldmarks=TmB, % enable three foldmarks on top, middle and bottom
fromphone=true % show the phone number
]{scrlttr2}
%
\usepackage{polyglossia} % set global language and hyphenation
\setdefaultlanguage{german}
%
\usepackage{hyperref} % for links in emails addresses etc
%
\usepackage{fontspec} % load the font, specify in next line
\usepackage{libertine} % https://r2src.github.io/top10fonts/
%
\usepackage{parskip} % let LaTeX create fancy parenthesis
%
\usepackage{graphics} % allow logos
%
\usepackage[normalem]{ulem} % allow underlining with \uline{}
%
\usepackage[
bottom=1.0cm
]{geometry}
%
\makeatletter
% Adjust the vertical spaces around the backaddress.
\setlength{\@tempskipa}{-1.2cm}%
\@addtoplength{toaddrheight}{\@tempskipa}
\makeatother
% Align the the different parts of the text
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}
\addtolength{\oddsidemargin}{-1in}
\setlength{\textwidth}{\useplength{firstheadwidth}}
\begin{document}
% Set variables from markdown header.
\setkomavar{fromname}{%
\small{$Absender$}
}
% Set signature field to the left
\renewcommand*{\raggedsignature}{\raggedright}
% Enforce left orientation (ragging into the right)
\setkomavar{fromaddress}{%
$for(Absenderadresse)$
\small $Absenderadresse$$sep$\\
$endfor$
}
\setkomavar{fromemail}[]{
\href{mailto:$E-Mail-Adresse$}{$E-Mail-Adresse$}
}
\setkomavar{fromphone}[]{
\href{tel:$Telefonnummer$}{$Telefonnummer$}
}
\setkomavar{signature}{
$Absender$
}
\setkomavar{date}{$Datum$}
\setkomavar{place}{$Ort$}
\setkomavar{title}{$Titel$}
\setkomavar{subject}{$Betreff$}
% --- BEGIN THE ACTUAL LETTER ---
\begin{letter}
{
$for(Empfängeranschrift)$
\small $Empfängeranschrift$$sep$\\
$endfor$
}
\opening{$Anrede$}
$body$
\closing{$Grußformel$}
\ps $Postscriptum$
\vspace{20mm}
$if(Anlagen)$
\uline{Anlagen}\par \vspace{-20mm}
$for(Anlagen)$
-- \small $Anlagen$$sep$\\
$endfor$
$endif$
\end{letter}
\end{document}