letter

A simple LaTeX letter template
git clone https://git.ckiri.com/cmk/letter.git
Log | Files | Refs | README | LICENSE

commit c4404c2dfd84cb154f1de98da711cda426dcc043
Author: Chris Kiriakou <chris@kiriakou.net>
Date:   Fri, 25 Sep 2026 01:11:26 +0200

First Commit

Diffstat:
A.gitignore | 6++++++
ALICENSE | 21+++++++++++++++++++++
AMakefile | 22++++++++++++++++++++++
AREADME.md | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/template.tex | 16++++++++++++++++
Amain.tex | 50++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 169 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,6 @@ +build +assets +main.new.tex +config.tex +content/* +!content/template.tex diff --git a/LICENSE b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Chris Kiriakou + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile @@ -0,0 +1,22 @@ +doc ?= template + +ENGINE = pdflatex +BUILD_DIR = ./build +MAIN = ./main.tex +CONTENT_DIR = ./content + +.PHONY: all dirs ats clean + +all: pdf + +dirs: + @mkdir -p $(BUILD_DIR) + +pdf: $(MAIN) $(CONTENT_DIR)/$(doc).tex dirs + $(ENGINE) -output-directory=$(BUILD_DIR) -jobname=$(doc) "$(ATS_FLAG)\def\doc{$(doc)}\input{config}\input{$(MAIN)}" + +flatten: $(BUILD_DIR)/$(doc).pdf + gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=$(BUILD_DIR)/$(doc)-flat.pdf $(BUILD_DIR)/$(doc).pdf + +clean: $(BUILD_DIR) + @rm -rf $(BUILD_DIR)/{*.aux,*.log} diff --git a/README.md b/README.md @@ -0,0 +1,54 @@ +# A simple LaTeX letter template + +## How To + +Create a `config.tex` inside the projects root directory, specifying your +personal information: +```tex +\def\authorname{Chris Kiriakou} +\def\authorplace{Musterstadt} +\def\authoraddress{Musterstraße 1, 10115 \authorplace} +\def\authorphone{+49 151 98765432} +\def\authoremail{c@kiri.com} +\def\authorwebsite{https://www.ckiri.com} +``` + +To build the PDF document, run: +```sh +make doc=<content_name> +``` + +NOTE: The document (`<content_name>`) specified needs to be available inside +the `content` directory. + +If the `doc` cli parameter isn't specified, it defaults to `template` (a simple +showcase document) + +## Misc + +### Flatten the document + +If *active* contents are prohibited (due to security concerns), flatten the PDF +after building it: +```sh +make doc=<document_name> flatten +``` + +### Options + +Options[1] and configuration of the document are set inside `main.tex`: + +| Option | Description | +|--------|-------------| +| `firstfoot=false` | Disable footer on first page | +| `fromurl=false` | Hide senders url (e.g. website) from header | +| `fromemail=false` | Hide senders email address from header | +| `fromphone=false` | Hide senders phone number from header | +| `fromrule=false` | Hide horizontal ruler dividing sender header from rest | +| `\usepackage[ngerman]{babel}` | Use German locale; comment out to use your default locale | +| `\LoadLetterOption{DIN}` | Use a DIN letter | + +--- + +[1] +:: Kohm, M. (November 2025). _KOMA - Script_ <https://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf> diff --git a/content/template.tex b/content/template.tex @@ -0,0 +1,16 @@ +\setkomavar{subject}{Betreff des Anschreibens} + +% Empfängeradresse +\begin{letter}{ + Vorname Nachname\\ + Unternehmen\\ + Abteilung\\ + Straße Hausnummer\\ + Postleitzahl Stadt +} + +\opening{Sehr geehrte Damen und Herren,} + +Inhalt des Anschreibens. + +Mit freundlichen Grüßen, diff --git a/main.tex b/main.tex @@ -0,0 +1,50 @@ +\documentclass[ + a4paper, + 10pt, + firstfoot=false, % Set true to include footer on first letter page + fromalign=left, + fromurl=true, % Set true to display <my_url> in sender header + fromemail=true, % Set true to display <my_email> in sender header + fromphone=true, % Set true to display <my_phone_no> in sender header + fromrule=false % Set true to display a horizontal ruler dividing sender header from rest +]{scrlttr2} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[ngerman]{babel} % Uncomment for german locale +\usepackage[bottom=0cm]{geometry} % Allows for more content space +\usepackage{helvet} % Use Sans-serif font +\usepackage{lipsum} +\usepackage{graphicx} +\usepackage[ + pdfauthor={\authorname}, + pdfcreator={LaTeX}, + pdfproducer={pdfLaTeX} +]{hyperref} + +\renewcommand{\familydefault}{\sfdefault} % Override default font +\frenchspacing +\sffamily +\setlength{\parskip}{1em} % Set distance between paragraphs +\setlength{\parindent}{0pt} +\LoadLetterOption{DIN} % Uncoment to use DIN formatted letter used in Germany + +\begin{document} + +\setkomavar{fromname}{\authorname} +\setkomavar{fromaddress}{\authoraddress} +\setkomavar{fromemail}{\authoremail} +\setkomavar{fromurl}{\authorwebsite} +\setkomavar{fromphone}{\authorphone} +\setkomavar{signature}{ } +\setkomavar{place}{\authorplace} +\setkomavar{date}{\today} + +\input{content/\doc} % The letter content + +\includegraphics[width=0.225\linewidth]{assets/signature} \\ +\authorname + +\end{letter} + +\end{document}