texlive[76175] Master/texmf-dist: envelope-letter (28aug25)

commits+karl at tug.org commits+karl at tug.org
Fri Aug 29 16:02:44 CEST 2025


Revision: 76175
          https://tug.org/svn/texlive?view=revision&revision=76175
Author:   karl
Date:     2025-08-29 16:02:44 +0200 (Fri, 29 Aug 2025)
Log Message:
-----------
envelope-letter (28aug25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/envelope-letter/README
    trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.pdf
    trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.tex
    trunk/Master/texmf-dist/tex/latex/envelope-letter/envelope-letter.sty

Modified: trunk/Master/texmf-dist/doc/latex/envelope-letter/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/envelope-letter/README	2025-08-29 14:02:34 UTC (rev 76174)
+++ trunk/Master/texmf-dist/doc/latex/envelope-letter/README	2025-08-29 14:02:44 UTC (rev 76175)
@@ -1,7 +1,8 @@
-This package provides a command \makeenvelope which draws a layout to fold the first page of a letter into its own envelope, fulfilled with the recipient's and sender's address.
+This package provides the \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.
 
-The package also provides an estimation of the total letter's mass to foresee the stamping rate, and can print a stamp provided as a picture on the envelope.
+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.
 
-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.
+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.
 
 This package is provided under GNU General Public Licence v3 (https://www.gnu.org/licenses/gpl-3.0.en.html), or any later version.

Modified: trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.tex	2025-08-29 14:02:34 UTC (rev 76174)
+++ trunk/Master/texmf-dist/doc/latex/envelope-letter/envelope-letter-documentation.tex	2025-08-29 14:02:44 UTC (rev 76175)
@@ -6,7 +6,10 @@
 \usepackage[inter-unit-product={\cdot}]{siunitx}
 \usepackage{envelope-letter}
 
-\title{Package \texttt{envelope-letter}\\\Large version 1.0}
+\setlength\parskip{0.7\baselineskip}
+\newcommand{\optarg}[1]{$\langle$\textit{#1}\,$\rangle$}
+
+\title{Package \texttt{envelope-letter}\\\Large version 1.1}
 \author{Florian Tasso \thanks{E-mail: florian dot tasso at gmail dot com.}}
 
 \begin{document}
@@ -13,9 +16,9 @@
 	\maketitle
 
 	\begin{abstract}
-		This package provides a command \verb|\makeenvelope| which draws a layout to fold the first page of a letter into its own envelope, fulfilled with the recipient's and sender's address.
+		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.
 
-		The package also provides an estimation of the total letter's mass to foresee the stamping rate, and can print a stamp provided as a picture on the envelope.
+		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.
 
 		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.
 	\end{abstract}
@@ -28,16 +31,20 @@
 
 	\clearpage
 
-	\section{Basic usage}
-		Currently, this package has been developped with the \href{https://ctan.org/pkg/letter}{\texttt{letter}} class only in mind (although it may work with other letter classes). This limitation is intended to be removed in a future release.
-
+	\section{Basic Usage}
 		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.
 
-		The command \verb|\setstamp{|<\emph{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.
+		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.
 
-		When writing is finished, print the letter, fold the envelope and add the requierd 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.
+		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.
 
-	\section{Folding the envelope}
+		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}).
+
+		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.
+
+	\clearpage
+
+	\section{Folding The Envelope}
 		Here is a preview of the default printed layout:
 
 		\makeatletter
@@ -45,11 +52,11 @@
 		\setlength{\el at l}{10.5cm}
 		\setlength{\el at L}{14.85cm}
 
-		\def\fromname{\small Sender's Name}
-		\def\fromaddress{\small Sender's street, 00\\00000 City S}
+		\def\fromname{\small Sender Name}
+		\def\fromaddress{\small Sender address\\00000 City S}
 
-		\def\toname{\small Recipient's Name}
-		\def\toaddress{\small Recipient's street, 00\\00000 City R}
+		\def\toname{\small Recipient Name}
+		\def\toaddress{\small Recipient address\\00000 City R}
 
 		\setstamp{\fbox{\rule[-0.13cm]{0pt}{0.6cm}\textbf{\Large S}}}
 
@@ -60,9 +67,9 @@
 				\el at foldsteps
 				\el at openinginstructions
 
-			\node[align=left, below right, inner sep=1em, rotate=180+\el at angleP] at (0.8125\el at l,0.75\el at L) {\fromname\\\fromaddress};
-			\node[align=left, below right, inner sep=1em, rotate=\el at angleP] at (0.5\el at l,0.5625\el at L) {\toname\\\toaddress};
-			\ifdefined\stamp \node[below left, inner sep=2em, rotate=\el at angleP] at (0.875\el at l,0.75\el at L) {\stamp}; \fi
+			\node[align=left, below right, inner sep=1em, rotate=180] at (0.8125\el at l,0.75\el at L) {\fromname\\\fromaddress};
+			\node[align=left, below right, inner sep=1em] at (0.5\el at l,0.5625\el at L) {\toname\\\toaddress};
+			\node[below left, inner sep=2em] at (0.875\el at l,0.75\el at L) {\stamp};
 			\end{tikzpicture}
 		\end{center}
 
@@ -72,19 +79,19 @@
 
 		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.
 
-			Stamp is here just as an illustration. If none is supplied, nothing is drawn (default behaviour). Other package options can customize what is actually printed (see below).
+		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}).
 
-	\section{Options}
-		This packages provides several options to control what should be drawn. These options can be passed directly to the package at loading, or using the \verb|\envelopesetup| command anywhere in the document. In these cases, options will be applied for all following envelopes created in the document.
+		\section{Options}\label{sec:options}
+		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|]|.
 
-		Options can also be passed as an optional argument to the \verb|\makeenvelope| command using the syntax \linebreak\verb|\makeenvelope[|<\emph{options}>\verb|]|. In this case, they will have effect for the current letter only, temporarily overwriting global options.
+		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.
 
-		Options are input as a comma separated list of <\emph{key}>=<\emph{value}> pairs and processed by \verb|\pgfkeys|. Supported options are:
+		Options are input as a comma separated list of \optarg{key}=\optarg{value} pairs and processed by \verb|\pgfkeys|. Supported options are:
 		\begin{itemize}
-			\item \verb|grammage=|<\emph{number}>: set grammage (surface density) of paper (in \unit{\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)} (\emph{default \qty{80}{\gram\per\square\meter}}),
+			\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)},
 
-			\item \verb|fold lines mode=|<\emph{number}>: set lines drawing mode (\verb|0|: no lines, \verb|1|: only fold ticks, \verb|2|: full fold lines), (\emph{default} \verb|2|),
-			\item \verb|lines|: print full fold lines (equivalent to \verb|fold lines mode=2|) (\emph{default}),
+			\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|),
+			\item \verb|lines|: print full fold lines (equivalent to \verb|fold lines mode=2|, \emph{default}),
 			\item \verb|ticks|: print only fold ticks (reduces ink consumption and visual overload, equivalent to \verb|fold lines mode=1|),
 			\item \verb|no lines|: for hardcore users (equivalent to \verb|fold lines mode=0|),
 
@@ -91,7 +98,7 @@
 			\item \verb|steps|: print folding steps (\emph{default}),
 			\item \verb|no steps|: do not print folding steps,
 
-			\item \verb|instructions|: print opening instructions, to prevent recipient opening the letter by cutting the top edge (scissors symbols) (\emph{default}),
+			\item \verb|instructions|: print opening instructions, to prevent recipient opening the letter by cutting the top edge (scissors symbols, \emph{default}),
 			\item \verb|no instructions|: do not print opening instruction (to save ink, or when you trust the recipient to open the letter safely).
 		\end{itemize}
 
@@ -99,10 +106,20 @@
 		\begin{itemize}
 			\item \verb|full|: shortand for "\verb|lines, steps, instructions|" (\emph{default situation}),
 			\item \verb|eco|: shortand for "\verb|ticks, no steps, no instructions|",
-			\item \verb|empty|: shortand for "\verb|no lines, no steps, no instructions|".
+			\item \verb|empty|: shortand for "\verb|no lines, no steps, no instructions|",
+			\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,
+			\item \verb|manual|: the \verb|\makeenvelope| command should be manually called (\emph{default}).
 		\end{itemize}
+		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.
 
-	\section{Layout proportions}
+		Addresses can be manually supplied using the following keys. They default to the values set by class parameters:
+		\begin{itemize}
+			\item \verb|to=|\optarg{text string}: sets the recipient's address,
+			\item \verb|from=|\optarg{text string}: sets the sender's address.
+		\end{itemize}
+		Addresses should be enclosed by curly braces. It is mandatory if they contain a comma. To split lines, simply use the \verb|\\| command.
+
+	\section{Layout Proportions}
 		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:
 		\begin{itemize}
 			\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,
@@ -111,6 +128,13 @@
 		\end{itemize}
 
 	\section{Dependencies}
-			This packages relies on and loads the 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}}.
+			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}}.
 
+	\section{Change History}
+		\begin{description}
+			\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.
+
+			\item[v1.0 \textnormal{(2025/08/21)}] Initial release.
+		\end{description}
+
 \end{document}

Modified: trunk/Master/texmf-dist/tex/latex/envelope-letter/envelope-letter.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/envelope-letter/envelope-letter.sty	2025-08-29 14:02:34 UTC (rev 76174)
+++ trunk/Master/texmf-dist/tex/latex/envelope-letter/envelope-letter.sty	2025-08-29 14:02:44 UTC (rev 76175)
@@ -1,7 +1,6 @@
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{envelope-letter}[2025/08/21 Package allowing to fold a letter into its own envelope.]
+\ProvidesPackage{envelope-letter}[2025/08/28 Package allowing to fold a letter into its own envelope.]
 %TODO:
-%  - adapt addresses to other classes than letter
 %  - add support for alternative paper aera density and unit (US system, oz/ft^2...)
 
 \RequirePackage{tikz}
@@ -15,6 +14,7 @@
 \def\el at setfoldlinesmode#1{\def\el at foldlinesmode{#1}} \el at setfoldlinesmode{2}%0: none, 1: ticks, 2: lines
 \newif\ifel at foldsteps \el at foldstepstrue
 \newif\ifel at openinginstructions \el at openinginstructionstrue
+\newif\ifel at autoenvelope \el at autoenvelopefalse
 
 \pgfkeys{grammage/.code=\el at setgrammage{#1}}
 
@@ -32,6 +32,12 @@
 \pgfkeys{full/.code=\el at setfoldlinesmode{2}\el at foldstepstrue\el at openinginstructionstrue}
 \pgfkeys{eco/.code=\el at setfoldlinesmode{1}\el at foldstepsfalse\el at openinginstructionsfalse}
 \pgfkeys{empty/.code=\el at setfoldlinesmode{0}\el at foldstepsfalse\el at openinginstructionsfalse}
+
+\pgfkeys{from/.code=\def\fromaddress{#1}}
+\pgfkeys{to/.code=\def\toaddress{#1}}
+
+\pgfkeys{auto/.code=\el at autoenvelopetrue}
+\pgfkeys{manual/.code=\el at autoenvelopefalse}
 \ProcessPgfPackageOptions{}
 
 \def\envelopesetup#1{\pgfkeys{#1}}
@@ -38,9 +44,21 @@
 
 \def\setstamp#1{\def\stamp{#1}} \setstamp{}
 
+\ifdefined\letter\else
+	\newenvironment{letter}{}{}\fi
+
 \newcounter{letter}
 \AddToHook{env/letter/begin}{\stepcounter{letter}}
 
+\ifdefined\opening
+	\AddToHook{cmd/opening/before}{\ifel at autoenvelope\makeenvelope\fi}
+\else
+	\AddToHook{env/letter/begin}{\ifel at autoenvelope\makeenvelope\fi}
+\fi
+
+\newif\ifel at statsswitch \el at statsswitchfalse
+\AddToHook{env/letter/end}{\ifel at statsswitch\el at printstats\fi}
+
 \newlength\el at l
 \newlength\el at L
 \ifdim\paperwidth>\paperheight
@@ -138,12 +156,16 @@
 	\FPeval\papermass{round(sheetscount*grammage*sheetsurface:1)} %g
 	\FPeval\papersurface{round(sheetsurface*sheetscount:4)} %m^2
 
-	\def\el at toname##1##2##3{##3}
+	\@ifclassloaded{letter}{\def\el at toname##1##2##3{##3}}{\def\el at toname##1{##1}}
 
 	\typeout{}
 	\typeout{}
 	\typeout{========= envelope-letter info =========}
-	\typeout{\space Letter \theletter, to \expandafter\el at toname\toname:}
+	\ifx\toname\empty
+		\typeout{\space Letter \theletter:}
+	\else
+		\typeout{\space Letter \theletter, to \expandafter\el at toname\toname:}
+	\fi
 	\typeout{\space\space - grammage: \grammage\space g/m^2}
 	\typeout{\space\space - pages count (incl. envelope): \thepage}
 	\typeout{\space\space - paper sheets count: \sheetscount}
@@ -152,8 +174,10 @@
 	\typeout{========================================}
 	\typeout{}
 	\typeout{}
-	\addtocounter{page}{-1}}
+	\addtocounter{page}{-1}
 
+	\el at statsswitchfalse}
+
 \def\makeenvelope{\@ifnextchar[{\el at makeenvelope}{\el at makeenvelope[]}}
 \def\el at makeenvelope[#1]{
 	\pgfkeys{#1}
@@ -160,7 +184,13 @@
 
 	\newgeometry{margin=0cm}
 	\thispagestyle{empty}
+	\@ifclassloaded{lettre}{\def\rule at length{0}\makeatother}{}
 
+	\ifdefined\fromaddress\else \def\fromaddress{}\fi
+	\ifdefined\toname\else \def\toname{}\fi
+	\ifdefined\toaddress\else \def\toaddress{}\fi
+
+	\noindent
 	\begin{tikzpicture}[scale=0.999, rotate=\el at angleP]
 		\draw[opacity=0] (0,0) -- (\el at l,\el at L);
 
@@ -168,7 +198,7 @@
 		\ifel at foldsteps \el at foldsteps \fi
 		\ifel at openinginstructions \el at openinginstructions \fi
 
-		\node[align=left, below right, inner sep=1em, rotate=180+\el at angleP] at (0.8125\el at l,0.75\el at L) {\fromname\\\fromaddress};
+		\node[align=left, below right, inner sep=1em, rotate=180+\el at angleP] at (0.8125\el at l,0.75\el at L) {\fromaddress};
 		\node[align=left, below right, inner sep=1em, rotate=\el at angleP] at (0.5\el at l,0.5625\el at L) {\toname\\\toaddress};
 		\ifdefined\stamp \node[below left, inner sep=2em, rotate=\el at angleP] at (0.875\el at l,0.75\el at L) {\stamp}; \fi
 	\end{tikzpicture}
@@ -175,7 +205,5 @@
 	\restoregeometry
 	\addtocounter{page}{-1}
 
-	\AddToHook{env/letter/end}[envelope-letter]{
-		\el at printstats
-		\RemoveFromHook{env/letter/end}[envelope-letter]}}
+	\el at statsswitchtrue}
 



More information about the tex-live-commits mailing list.