\documentclass[a4paper,11pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=25mm]{geometry}
\usepackage{array}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{upquote}
\usepackage{xcolor}
\usepackage{fancyvrb}

\hypersetup{
  colorlinks=true,
  linkcolor=blue!50!black,
  urlcolor=blue!50!black
}

\title{onlinebrief24}
\author{Francesco Luciano}
\date{2026-03-27}

\begin{document}
\maketitle

\begin{abstract}
\texttt{onlinebrief24} is a LaTeX class for DIN 5008 type-B
business letters calibrated for use with \href{https://onlinebrief24.de}
{onlinebrief24.de}. It provides a plain letter layout, a modern variant with
header and footer, an optional DIN-style information block, and a technical
guides mode for layout inspection.
\href{https://onlinebrief24.de}{onlinebrief24.de} is a hybrid mail service for
business customers: documents are submitted digitally, and the service handles
printing, enveloping, franking, and postal delivery.
\end{abstract}

\section{Status}

The class is verified with pdfLaTeX, XeLaTeX, and LuaLaTeX. The supported and
hardened use case is one letter per document. The package is aimed at German
business letters and loads \texttt{babel} with \texttt{german} by default
(configurable via the \texttt{lang=} class option).

\section{Installation}

Install via your TeX distribution's package manager:

\begin{Verbatim}[fontsize=\small]
tlmgr install onlinebrief24
\end{Verbatim}

Then load the class in your document:

\begin{Verbatim}[fontsize=\small]
\documentclass{onlinebrief24}
\end{Verbatim}

\section{Engine Support}

\begin{itemize}
\item pdfLaTeX: verified
\item XeLaTeX: verified
\item LuaLaTeX: verified
\end{itemize}

With pdfLaTeX the class uses \texttt{fontenc} and \texttt{tgheros} (TeX Gyre
Heros). With XeLaTeX and LuaLaTeX it uses \texttt{fontspec}; Arial is preferred
if installed, otherwise it falls back to TeX Gyre Heros.

The \texttt{modern} style additionally loads \texttt{sourcesanspro} and
\texttt{fontawesome5} (for footer icons). Both packages are part of
\texttt{texlive-fonts-extra}.

\section{Minimal Example}

\begin{Verbatim}[fontsize=\small]
\documentclass[basic,lang=english]{onlinebrief24}

\setreturnaddress{Jane Smith, 12 Oak Street, Bristol BS1 4DJ}
\setrecipient{
  Example Services Ltd. \\
  Mr. John Smith \\
  24 Market Road \\
  London SW1A 1AA
}
\setsubject{Subject}
\setplace{Bristol}
\setdate{\today}

\begin{document}
\begin{letter}{}
\opening{Dear Mr. Smith,}

This is a sample letter.

\closing{Kind regards}
\end{letter}
\end{document}
\end{Verbatim}

\section{Options}

\begin{longtable}{@{}p{35mm}p{105mm}@{}}
\toprule
Option & Meaning \\
\midrule
\endhead
\texttt{basic} & Plain layout without header and footer. \\
\texttt{modern} & Modern layout with header, footer, and accent color. \\
\texttt{infoblock} & Show a DIN-style information block in the upper-right
header area. Only fields that are set are rendered. \\
\texttt{guides} & Technical overlay mode for checking the calibrated layout
zones, fold marks, and text start area. This mode is for inspection, not final
production output. \\
\texttt{footercenter} & Center the footer in modern mode. \\
\texttt{blue}, \texttt{orange}, \texttt{green}, \texttt{red},
\texttt{purple}, \texttt{grey}, \texttt{burgundy}, \texttt{black} &
Accent-color schemes for modern mode. \\
\texttt{lang=\textit{name}} & Document language passed to \texttt{babel}
(default: \texttt{german}). Any valid babel language name is accepted. The
\texttt{infoblock} labels are localized for \texttt{german}, \texttt{english}, \texttt{french}, \texttt{spanish},
\texttt{italian}, \texttt{dutch}, and \texttt{polish}. \\
\bottomrule
\end{longtable}

\section{Main Commands}

\begin{longtable}{@{}p{60mm}p{80mm}@{}}
\toprule
Command & Purpose \\
\midrule
\endhead
\texttt{\string\setreturnaddress\{...\}} & Mandatory one-line sender line for
the address window. \\
\texttt{\string\setrecipient\{...\}} & Recipient block for the address window.
Mandatory unless it is passed via \texttt{\string\begin\{letter\}\{...\}}. \\
\texttt{\string\setsubject\{...\}} & Subject line above the opening. \\
\texttt{\string\setdate\{...\}} & Date, defaulting to \texttt{\string\today}. \\
\texttt{\string\setplace\{...\}} & Place printed before the date. \\
\texttt{\string\encl\{...\}} & Enclosures listed below the closing; standard
KOMA-Script command. \\
\texttt{\string\setyourref\{...\}} & Information-block field for the recipient's
reference. \\
\texttt{\string\setyourmessage\{...\}} & Information-block field for the
recipient's dated message. \\
\texttt{\string\setourref\{...\}} & Information-block field for your own
reference. \\
\texttt{\string\setourmessage\{...\}} & Information-block field for your own
dated message. \\
\texttt{\string\setcontactname\{...\}} & Information-block contact name. \\
\texttt{\string\setcontactphone\{...\}} & Information-block contact phone
number. \\
\texttt{\string\setcontactfax\{...\}} & Information-block contact fax number.
\\
\texttt{\string\setcontactemail\{...\}} & Information-block contact email
address. \\
\texttt{\string\setfromfirstname\{...\}} & Modern-mode first name for the
header. \\
\texttt{\string\setfromlastname\{...\}} & Modern-mode last name for the header.
\\
\texttt{\string\setfromaddress\{...\}} & Modern-mode address line in the header.
\\
\texttt{\string\setfromlandline\{...\}} & Optional modern-mode footer field. \\
\texttt{\string\setfromphone\{...\}} & Optional modern-mode footer field. \\
\texttt{\string\setfromemail\{...\}} & Optional modern-mode footer field. \\
\texttt{\string\setfromweb\{...\}} & Optional modern-mode footer field. \\
\texttt{\string\setfromlinkedin\{...\}} & Optional modern-mode footer field. \\
\texttt{\string\setfromname\{...\}} & Legacy fallback if first and last name are
not split. \\
\midrule
\multicolumn{2}{@{}l}{\textit{Extensibility}} \\
\midrule
\texttt{\string\addfooteritem}\\
\texttt{\{\textit{icon}\}\{\textit{text}\}} &
Append a custom item to the modern-mode footer. The icon is a
\texttt{fontawesome5} command. Multiple calls append in order. \\
\texttt{\string\addinfoblockrow}\\
\texttt{\{\textit{label}\}\{\textit{value}\}} &
Append a custom row to the DIN-style information block. Empty values are
silently omitted. \\
\midrule
\multicolumn{2}{@{}l}{\textit{Layout tuning}} \\
\midrule
\texttt{\string\setinfoblocktopoffset\{\textit{dim}\}} &
Vertical offset from the page top to the information block (default: 50mm). \\
\texttt{\string\setinfoblockrightedge\{\textit{dim}\}} &
Horizontal distance from the left page edge to the block's right edge (default: 200mm). \\
\texttt{\string\setinfoblockcolwidths}\\
\texttt{\{\textit{label}\}\{\textit{sep}\}\{\textit{value}\}} &
Column widths for the information-block tabular (defaults: 30mm, 2mm, 43mm). \\
\bottomrule
\end{longtable}

\section{Validation and Layout Guarantees}

The class validates the mandatory address-window fields when a letter starts.
Compilation stops with a clear error if the return address is missing, the
recipient is missing, or the return address is too long for the single-line
sender zone.

If the \texttt{infoblock} option is enabled, the information block is rendered
independently from the body text flow. This keeps the text start stable while
showing only the fields that are actually set.

For multipage letters, the address-window overlay, fold marks, and optional
modern header and footer are restricted to page 1. Continuation pages start
near the normal top margin instead of inheriting the first-page window offset.

\section{Calibration}

The layout is calibrated against the practical preview behavior of
\href{https://onlinebrief24.de}{onlinebrief24.de}, not only against the
nominal measurement graphic. In practice, the class uses effective window zones
of 50--52\,mm, 52--72\,mm, and 72--92\,mm to match the real preview more
closely.

\section{Guides Mode}

The \texttt{guides} option enables a technical overlay that visualises all DIN
5008 layout zones, fold marks, and the text-start line directly in the PDF.
It is intended for calibration and debugging, not for final output.

\begin{Verbatim}[fontsize=\small]
\documentclass[guides]{onlinebrief24}
\end{Verbatim}

The overlay draws:

\begin{itemize}
\item \textbf{Zone 1} (blue, 50--52\,mm from top): the 2\,mm sender line.
\item \textbf{Zone 2} (red, 52--72\,mm from top): reserved area for postal
      codes and franking marks.
\item \textbf{Zone 3} (green, 72--92\,mm from top): the recipient address block.
\item Fold-mark annotations at 105\,mm and 205\,mm from the top, matching the
      two fold positions for a DIN C6/5 window envelope.
\item A dashed text-start line at 110\,mm and a vertical text-alignment guide
      at the 25\,mm left margin.
\end{itemize}

The \texttt{guides} option can be combined with \texttt{basic} or
\texttt{modern}; remove it before submitting to the print service.

\section{Extensibility}

\subsection{Custom footer items (\texttt{modern} style)}

In modern mode the footer can be extended with additional contact fields using
\texttt{\string\addfooteritem}:

\begin{Verbatim}[fontsize=\small]
\documentclass[modern]{onlinebrief24}
\addfooteritem{\faGithub}{github.com/example}
\addfooteritem{\faXTwitter}{@example}
\end{Verbatim}

Each item requires a \texttt{fontawesome5} icon command and a text label. Items
are appended after the standard footer fields (landline, mobile, email, web,
LinkedIn) and separated by the standard vertical-bar separator. The macro must
be called in the preamble.

\subsection{Custom infoblock rows (\texttt{infoblock} option)}

Additional rows can be appended to the DIN-style information block:

\begin{Verbatim}[fontsize=\small]
\documentclass[infoblock]{onlinebrief24}
\addinfoblockrow{Department}{Engineering}
\addinfoblockrow{Project}{OB24-2026}
\end{Verbatim}

Custom rows follow the same column widths and typography as the built-in rows.
Empty values are silently omitted, consistent with the built-in row behaviour.

\subsection{Information block layout tuning}

The position and column widths of the information block can be adjusted without
editing the class file:

\begin{Verbatim}[fontsize=\small]
\setinfoblocktopoffset{55mm}         % vertical offset from page top
\setinfoblockrightedge{195mm}        % right edge from left page margin
\setinfoblockcolwidths{28mm}{2mm}{45mm} % label / gap / value widths
\end{Verbatim}

These macros must be called in the preamble after \verb|\documentclass|.
The defaults match the DIN 5008 Form B reference geometry.

\section{Examples}

The package ships with two focused example documents covering:

\begin{itemize}
\item the basic layout with the DIN-style information block
\item the modern layout with the DIN-style information block
\end{itemize}

Both bundled example documents use English sample data so the generated PDFs
double as immediately readable CTAN previews.

\section{License and Project Status}

This package is distributed under the LaTeX Project Public License (LPPL) 1.3c.
It is a community project and has no official affiliation with letterei.de
Postdienste GmbH. The trademark holders have formally authorized the maintainer
to use the onlinebrief24.de mark in connection with this LaTeX class.

\end{document}
