easyLetter/easyLetter.cls

73 lines
1.6 KiB
OpenEdge ABL
Raw Normal View History

2023-04-04 16:00:42 +02:00
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{easyLetter}[2023/04/04 Easy letter preset]
\LoadClass[12pt]{lettre}
\AtEndPreamble{
% Encodage
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
% Langue
\RequirePackage[french]{babel}
% Police
\RequirePackage{fontspec}
\setmainfont[Numbers={Monospaced}]{Fira Sans}
\setmonofont{Fira Code}
% Retire le trait
\makeatletter
\newcommand*{\NoRule}{\renewcommand*{\rule@length}{0}}
\makeatother
\NoRule
% Liens cliquable + metadata
\RequirePackage[pdfauthor={\@author},
pdftitle={\@title},
pdfsubject={\@subject},
pdfkeywords={\@author, lettre\@keywords},
pdfcreator={LaTeX with 'easyLetter' preset},
% Cache les liens
hidelinks
]{hyperref}
}
% Titre du document
\newcommand*{\titre}[1]{\def\@title{#1}}
% Auteur
\newcommand*{\auteur}[1]{\def\@author{#1}}
% Opening
\newcommand{\ouverture}[1]{\def\@opening{#1}}
% Closing
\newcommand{\cloture}[1]{\def\@closing{#1}}
% Subject
\def\@subject{\,}
\newcommand*{\sujet}[1]{\def\@subject{#1}}
% Keywords
\def\@keywords{\,}
\newcommand*{\motscles}[1]{\def\@keywords{\if#1\empty\else, #1\fi}}
% Receiver
\newcommand{\destinataire}[3]{\def\@receivername{#1}\def\@receiverAddress{#2}\def\@receiverCity{#3}}
% Letter content
\newenvironment{easyLetter}{
\begin{letter}{
% Destinataire
\@receivername \\
\@receiverAddress \\
\textsc{\@receiverCity}
}
\conc{\@title}
\opening{\@opening}}{
\closing{\@closing}
\end{letter}
}