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