Debian Codegraph @

texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.tex

raw
1 \documentclass{article}
2
3 \usepackage[a4paper, margin=1.7cm]{geometry}
4 \usepackage[colorlinks=true, linkcolor=black, urlcolor=blue]{hyperref}
5 \usepackage{xurl}
6 \usepackage[inter-unit-product={\cdot}]{siunitx}
7 \usepackage{envelope-letter}
8
9 \setlength\parskip{0.7\baselineskip}
10 \newcommand{\optarg}[1]{$\langle$\textit{#1}\,$\rangle$}
11
12 \title{Package \texttt{envelope-letter}\\\Large version 1.1}
13 \author{Florian Tasso \thanks{E-mail: florian dot tasso at gmail dot com.}}
14
15 \begin{document}
16 \maketitle
17
18 \begin{abstract}
19 This package provides the \verb|\makeenvelope| command, which draws a layout for folding the first page of a letter into its own envelope, filled in with both recipient and sender addresses.
20
21 The package also provides an estimation of the total letter's mass to foresee the stamping rate, and can print a digital stamp on the envelope.
22
23 It can be useful when running out of envelopes, or to spare a little of paper (especially when letter is an odd number pages long). It can also help implementing a (somewhat "poor man's") automated batch letter generating system.
24 \end{abstract}
25
26 \vfil
27
28 \tableofcontents
29
30 \vfil
31
32 \clearpage
33
34 \section{Basic Usage}
35 Simply load the package using \verb|\usepackage{envelope-letter}|, and start writing your letter as usual. Right after the \verb|\begin{letter}| statement, use the command \verb|\makeenvelope| to print the layout on a newly inserted page, just before the letter body\footnote{The envelope is not taken into account in the letter's page numbering.}. The layout automatically adjusts itself to any paper format and orientation.
36
37 The command \verb|\setstamp{|\optarg{stamp \LaTeX\ material}\verb|}| enables to add stamps. Invoked just before \verb|\makeenvelope| within the \verb|letter| environment sets the stamp for the current envelope only. Used anywhere else outside applies this stamp to every subsequent envelopes.
38
39 When writing is finished, print the letter, fold the envelope and add the required stamps. Seal it and just send it. If the letter is more than one page long, one can simply fold the extra paper sheets and put them into the envelope.
40
41 This package works with classes \href{https://ctan.org/pkg/letter}{\texttt{letter}} and \href{https://ctan.org/pkg/lettre}{\texttt{lettre}} (and probably other), that is to say it automatically extracts recipient and sender addresses from file content. Two keys are also provided to manually specify these addresses, so the package can work with virtually any class, even non-letter-related ones like \verb|article| (see section \ref{sec:options}).
42
43 The \verb|\makeenvelope| can actually be used anywhere in the \verb|document| environment. However, mass-related information is computed and diplayed only when ending \verb|letter| environment. To preserve this feature, a minimal \verb|letter| environment is provided by the package, if not already existing. It does nothing special, but offering a frame to enable advanced package functioning.
44
45 \clearpage
46
47 \section{Folding The Envelope}
48 Here is a preview of the default printed layout:
49
50 \makeatletter
51
52 \setlength{\el@l}{10.5cm}
53 \setlength{\el@L}{14.85cm}
54
55 \def\fromname{\small Sender Name}
56 \def\fromaddress{\small Sender address\\00000 City S}
57
58 \def\toname{\small Recipient Name}
59 \def\toaddress{\small Recipient address\\00000 City R}
60
61 \setstamp{\fbox{\rule[-0.13cm]{0pt}{0.6cm}\textbf{\Large S}}}
62
63 \begin{center}
64 \begin{tikzpicture}
65 \draw (0,0) -- (0,\el@L) -- (\el@l,\el@L) -- (\el@l,0) -- cycle;
66 \el@plotfoldlines
67 \el@foldsteps
68 \el@openinginstructions
69
70 \node[align=left, below right, inner sep=1em, rotate=180] at (0.8125\el@l,0.75\el@L) {\fromname\\\fromaddress};
71 \node[align=left, below right, inner sep=1em] at (0.5\el@l,0.5625\el@L) {\toname\\\toaddress};
72 \node[below left, inner sep=2em] at (0.875\el@l,0.75\el@L) {\stamp};
73 \end{tikzpicture}
74 \end{center}
75
76 \makeatother
77
78 Folding the envelope is quite straightforward. Looking at the recto of the envelope (like in the current example), simply fold the line to hide the flaps behind the paper sheet, following the steps from 1 to 3. To seal the envelope, put adhesive tape on the sides of the rear flaps\footnote{Glue should be avoided, as it may result in tearing the letter up when opening.}.
79
80 Scissors symbols are instructions to the recipient, to remind not to cut the top of the envelope. While this is the standard way to proceed, with the here crafted envelope it will result in ripping the header of the letter.
81
82 Stamp is drawn here just as an illustration. If none is supplied, nothing is drawn (default behaviour). Other package options can customize what is actually printed (see section \ref{sec:options}).
83
84 \section{Options}\label{sec:options}
85 This package provides several options to control what should be drawn. These options can be passed directly to the package at loading, using the \verb|\envelopesetup{|\optarg{options}\verb|}| command, or as an optional argument to the \verb|\makeenvelope| command, using the syntax \verb|\makeenvelope[|\optarg{options}\verb|]|.
86
87 If those commands are used in the main document's scope, options will be applied for all following envelopes created in the document. If they are used in the \verb|letter| environment, since it starts a new group under the hood, options will have effect for the current letter only, temporarily overwriting global options.
88
89 Options are input as a comma separated list of \optarg{key}=\optarg{value} pairs and processed by \verb|\pgfkeys|. Supported options are:
90 \begin{itemize}
91 \item \verb|grammage=|\optarg{number}: set grammage (surface density) of paper (in \unit{\gram\per\square\meter}, \emph{default} \qty{80}{\gram\per\square\meter})\footnote{Other grammage system and units should be implemented in a future release (pound per ream, \unit{oz\per\square{ft}}\dots)},
92
93 \item \verb|fold lines mode=|\optarg{number}: set lines drawing mode (\verb|0|: no lines, \verb|1|: only fold ticks, \verb|2|: full fold lines, \emph{default}~\verb|2|),
94 \item \verb|lines|: print full fold lines (equivalent to \verb|fold lines mode=2|, \emph{default}),
95 \item \verb|ticks|: print only fold ticks (reduces ink consumption and visual overload, equivalent to \verb|fold lines mode=1|),
96 \item \verb|no lines|: for hardcore users (equivalent to \verb|fold lines mode=0|),
97
98 \item \verb|steps|: print folding steps (\emph{default}),
99 \item \verb|no steps|: do not print folding steps,
100
101 \item \verb|instructions|: print opening instructions, to prevent recipient opening the letter by cutting the top edge (scissors symbols, \emph{default}),
102 \item \verb|no instructions|: do not print opening instruction (to save ink, or when you trust the recipient to open the letter safely).
103 \end{itemize}
104
105 Some shortand keys are also provided:
106 \begin{itemize}
107 \item \verb|full|: shortand for "\verb|lines, steps, instructions|" (\emph{default situation}),
108 \item \verb|eco|: shortand for "\verb|ticks, no steps, no instructions|",
109 \item \verb|empty|: shortand for "\verb|no lines, no steps, no instructions|",
110 \item \verb|auto|: the \verb|\makeenvelope| command is automatically invoked before the \verb|\opening| command or, if it is not defined, at the begining of the \verb|letter| environment,
111 \item \verb|manual|: the \verb|\makeenvelope| command should be manually called (\emph{default}).
112 \end{itemize}
113 Be aware that with the \verb|auto| key, any subsequent manual call of \verb|\makeenvelope| will draw additional envelopes. To avoid it, use \verb|\envelopesetup{manual}| or \verb|\makeenvelope[manual]| to restore manual operation mode.
114
115 Addresses can be manually supplied using the following keys. They default to the values set by class parameters:
116 \begin{itemize}
117 \item \verb|to=|\optarg{text string}: sets the recipient's address,
118 \item \verb|from=|\optarg{text string}: sets the sender's address.
119 \end{itemize}
120 Addresses should be enclosed by curly braces. It is mandatory if they contain a comma. To split lines, simply use the \verb|\\| command.
121
122 \section{Layout Proportions}
123 This envelope was inspired by this article: \url{https://www.imprimeur-imprimerie.com/comment-faire-une-enveloppe-avec-une-feuille-a4-astuces-pratiques}\footnote{Consulted in august 2025, in french. The article also gives motivation to craft such envelopes.}. For those interested in folding the envelope whitout using the package, here are the layout proportions:
124 \begin{itemize}
125 \item lines of step 1 are parallels to the longest side of the sheet, at $\frac{1}{8}$ and $\frac{7}{8}$ along the shortest side length from right to left. They can be obtained by folding the width of the paper three times in two,
126 \item lines of step 2 are the diagonals of the rectangles made by the top and bottom edges of the sheet, and the lines of step 3. These rectangles appear only when lines of step 1 are folded, but the dotted lines give a preview of those diagonals,
127 \item lines of step 3 are parallels to the shortest side of the sheet, at $\frac{1}{4}$ and $\frac{5}{8}$ along the longest side, from top to bottom. First, fold the height of the paper two times in two to make the flap (upper folding line), then fold the remaining aera in two to make the envelope container.
128 \end{itemize}
129
130 \section{Dependencies}
131 This package relies on and loads the following packages: \href{https://ctan.org/pkg/tikz}{\texttt{tikz}}, \href{https://ctan.org/pkg/pgfopts}{\texttt{pgfopts}}, \href{https://ctan.org/pkg/geometry}{\texttt{geometry}}, \href{https://ctan.org/pkg/graphics}{\texttt{graphics}}, \href{https://ctan.org/pkg/pifont}{\texttt{pifont}} and \href{https://ctan.org/pkg/fp}{\texttt{fp}}.
132
133 \section{Change History}
134 \begin{description}
135 \item[v1.1 \textnormal{(2025/08/28)}] Adding support for class \href{https://ctan.org/pkg/lettre}{\texttt{lettre}}, adding \verb|from|, \verb|to|, \verb|auto| and \verb|manual| keys, minor code optimisations.
136
137 \item[v1.0 \textnormal{(2025/08/21)}] Initial release.
138 \end{description}
139
140 \end{document}