Use custom class, simplifying template
This commit is contained in:
parent
adcd6db2ca
commit
6242ad5a86
3 changed files with 89 additions and 48 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
|||
Template/*
|
||||
!Template/*.tex
|
||||
|
||||
!*.cls
|
||||
!*.cfg
|
||||
!Makefile
|
||||
!README.md
|
||||
|
|
|
@ -1,64 +1,32 @@
|
|||
\documentclass[12pt]{lettre}
|
||||
|
||||
% Encodage
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
|
||||
% Langue
|
||||
\usepackage[french]{babel}
|
||||
|
||||
% Police
|
||||
\usepackage{fontspec}
|
||||
\setmainfont[Numbers={Monospaced}]{Fira Sans}
|
||||
\setmonofont{Fira Code}
|
||||
\documentclass{../easyLetter}
|
||||
|
||||
% Fix hauteur
|
||||
\renewcommand{\paperheight}{11in}
|
||||
|
||||
% Retire le trait
|
||||
\makeatletter
|
||||
\newcommand*{\NoRule}{\renewcommand*{\rule@length}{0}}
|
||||
\makeatother
|
||||
\NoRule
|
||||
|
||||
% Désactive les césures des mots
|
||||
\usepackage[none]{hyphenat}
|
||||
|
||||
% Titre du document
|
||||
\newcommand{\documentTitle}{Lettre}
|
||||
% Titre et auteur
|
||||
\titre{Lettre}
|
||||
\auteur{Prénom Nom}
|
||||
|
||||
% Auteur
|
||||
\newcommand{\documentAuthor}{Prénom Nom}
|
||||
% Ouverture et fermeture
|
||||
\ouverture{Madame, Monsieur}
|
||||
\cloture{Je vous prie de croire, Madame, Monsieur, en l'expression de
|
||||
mes salutations distinguées.}
|
||||
|
||||
% Liens cliquable + metadata
|
||||
\usepackage[pdfauthor={\documentAuthor},
|
||||
pdftitle={\documentTitle},
|
||||
pdfsubject={Lettre},
|
||||
pdfkeywords={\documentAuthor, lettre},
|
||||
pdfcreator={LaTeX with 'easyLetter' preset},
|
||||
% Cache les liens
|
||||
hidelinks
|
||||
]{hyperref}
|
||||
% Métadonnées
|
||||
% \sujet{} % facultatif
|
||||
% \motscles{} % facultatif, séparé par des virgules
|
||||
|
||||
% Destinataire
|
||||
\destinataire{NomDestinataire}{AdresseDestinataire}{VilleDestinataire}
|
||||
|
||||
% Import de lettre-expediteur.cfg (Expéditeur)
|
||||
\institut{../expediteur}
|
||||
|
||||
\begin{document}
|
||||
\begin{letter}{
|
||||
% Destinataire
|
||||
NomDestinataire \\
|
||||
AdresseDestinataire \\
|
||||
\textsc{VilleDestinataire}
|
||||
}
|
||||
\conc{\documentTitle}
|
||||
\opening{Madame, Monsieur}
|
||||
|
||||
|
||||
\begin{easyLetter}
|
||||
Blabla\dots
|
||||
|
||||
|
||||
\closing{Je vous prie de croire, Madame, Monsieur, en l'expression de
|
||||
mes salutations distinguées.}
|
||||
\end{letter}
|
||||
\end{easyLetter}
|
||||
\end{document}
|
||||
|
|
72
easyLetter.cls
Normal file
72
easyLetter.cls
Normal file
|
@ -0,0 +1,72 @@
|
|||
\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}
|
||||
}
|
Loading…
Reference in a new issue