From c6303e38664a7a78e8f21a4390b69e5aa9cf5c93 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 23 Oct 2020 03:02:00 +0000 Subject: CTAN sync 202010230301 --- macros/latex/contrib/scrlttr2copy/README.md | 8 +- macros/latex/contrib/scrlttr2copy/copy.lco | 81 ++++++++++----------- .../contrib/scrlttr2copy/letter-copy-test.pdf | Bin 88554 -> 88546 bytes .../contrib/scrlttr2copy/letter-copy-test.tex | 11 ++- 4 files changed, 53 insertions(+), 47 deletions(-) (limited to 'macros/latex/contrib/scrlttr2copy') diff --git a/macros/latex/contrib/scrlttr2copy/README.md b/macros/latex/contrib/scrlttr2copy/README.md index 77e30b6f8e..cea1bb15a4 100644 --- a/macros/latex/contrib/scrlttr2copy/README.md +++ b/macros/latex/contrib/scrlttr2copy/README.md @@ -1,5 +1,5 @@ # scrlttr2copy -A letter class option file for automatically creation of copies. +A letter class option file for automatically creation of page copies. The file `copy.lco` provides the new class option »copy« for the KOMA-Script letter class »scrlttr2«. If the option »copy« is given all pages of a specific @@ -7,6 +7,10 @@ letter are duplicated with background text marking as copies. For more details see the example document `letter-copy-test.tex`. -[Rolf Niepraschk](mailto:Rolf.Niepraschk@gmx.de), 2016-02-13 +This work may be distributed and/or modified under the conditions of the LaTeX +Project Public License, either version 1.3 of this license or (at your option) +any later version. + +Rolf Niepraschk diff --git a/macros/latex/contrib/scrlttr2copy/copy.lco b/macros/latex/contrib/scrlttr2copy/copy.lco index 260d3c6eb8..989449a59c 100644 --- a/macros/latex/contrib/scrlttr2copy/copy.lco +++ b/macros/latex/contrib/scrlttr2copy/copy.lco @@ -12,7 +12,7 @@ %% %% This work has the LPPL maintenance status "author-maintained". -\ProvidesFile{copy.lco}[2020/10/20 v0.2a copy letter-class-option (RN)] +\ProvidesFile{copy.lco}[2020/10/22 v0.3a copy letter-class-option (RN)] \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \IfFormatAtLeastTF{2020/10/01}{}{% \PackageError{copy.lco}{% @@ -25,49 +25,20 @@ \RequirePackage{xcolor,graphicx} -\newcounter{copy@pages} - -\AtBeginLetter{\shipout@copy}% Output the copy of the pages of the previous letter -\AtEndDocument{\shipout@copy}% Output the copy of the pages of the last letter - -\newcommand*\shipout@copy{% - \ifnum\c@copy@pages>\z@% ignore the following in the first \AtBeginLetter - \RemoveFromHook{shipout/before}[CP@save] - \if@twoside\ifodd\c@copy@pages - \@latex@info@no@line{Shipout an empty page}% - \shipout\null - \fi\fi - \immediate\closeout\@mainaux - \immediate\openout\@mainaux\jobname.aux - \begingroup - \c@page=\z@ - \AddToHook{shipout/background}[CP@marker]{\LetterCopyMarker}% - \loop\ifnum\c@page<\c@copy@pages - \advance\c@page\@ne - \@latex@info@no@line{Shipout copy of page \the\c@page}% - \setbox\ShipoutBox=\box\csname out@box\the\c@page\endcsname - \shipout\box\ShipoutBox - \repeat - \RemoveFromHook{shipout/background}[CP@marker] - \endgroup - \c@copy@pages=\z@ - \fi - % Saving all pages of the next letter - \AddToHook{shipout/before}[CP@save]{\save@page@copies} +\AtEndLetter{% Saving the number of total pages of each letter in a separate macro + \expandafter\xdef\csname CP@max@pages@\the\c@letter\endcsname{\the\c@page}% } -\newcommand*\save@page@copies{% - \@ifundefined{out@box\the\c@page}{% - \@latex@info@no@line{Alloc savebox for page \the\c@page}% - \expandafter\newsavebox\csname out@box\the\c@page\endcsname - }{% - \@latex@info@no@line{Savebox for page \the\c@page\space already exist}% - }% - \@latex@info@no@line{Save page \the\c@page\space to \string\out@box\the\c@page}% - \global\setbox\csname out@box\the\c@page\endcsname=\copy\ShipoutBox - \global\c@copy@pages=\c@page +\newcommand*\save@page@copies{% Saving each output page in a separate box + \expandafter\newsavebox\csname page@box@\the\c@letter @\the\c@page\endcsname + \@latex@info@no@line{Save page \the\c@page\space of letter \the\c@letter + \space to \string\page@box@\the\c@letter @\the\c@page}% + \global\setbox\csname page@box@\the\c@letter @\the\c@page\endcsname= + \copy\ShipoutBox } +\AddToHook{shipout/before}[CP@save]{\save@page@copies} + \newcommand*\LetterCopyMarker{% \put(0.5\paperwidth,-0.5\paperheight){% \makebox(0,0)[c]{\resizebox{\textwidth}{!}{\rotatebox{45}{% @@ -75,6 +46,34 @@ }% } +\AddToHook{enddocument/afteraux}[CP@shipout]{% + \RemoveFromHook{shipout/before}[CP@save]% + \if@twoside\ifodd\ReadonlyShipoutCounter + \@latex@info@no@line{Output an empty page}% + \shipout\null + \fi\fi + \AddToHook{shipout/background}[CP@marker]{\LetterCopyMarker}% + \@tempcnta=\z@ + \loop% iterate over all letters + \advance\@tempcnta\@ne + {% + \c@page=\z@ + \edef\@tempa{\@nameuse{CP@max@pages@\the\@tempcnta}}% total pages + \loop% iterate over all pages of this letter + \advance\c@page\@ne + \@latex@info@no@line{Output of the copy of page \the\c@page\space + of letter \the\@tempcnta}% + \setbox\ShipoutBox=\box\@nameuse{page@box@\the\@tempcnta @\the\c@page}% + \shipout\box\ShipoutBox + \ifnum \c@page < \@tempa + \repeat + }% + \ifnum \@tempcnta < \c@letter + \repeat + \RemoveFromHook{shipout/background}[CP@marker] + \RemoveFromHook{enddocument/afteraux}[CP@shipout] +} + \newkomavar[\copyname]{copy} \newcommand*\copyname{Copy} @@ -82,7 +81,7 @@ english,newzealand,UKenglish,USenglish}\copyname{Copy}% \defcaptionname{german,ngerman,austrian,naustrian,% swissgerman,nswissgerman}\copyname{Kopie} -\defcaptionname{acadian,canadien,francais,french}\copyname{Copie} +\defcaptionname{acadian,francais,french}\copyname{Copie} \defcaptionname{spanish,italian,portugese}\copyname{Copia} \defcaptionname{polish}\copyname{Kopia} \defcaptionname{russian}\copyname{Копия} diff --git a/macros/latex/contrib/scrlttr2copy/letter-copy-test.pdf b/macros/latex/contrib/scrlttr2copy/letter-copy-test.pdf index aee604b509..6a5f347143 100644 Binary files a/macros/latex/contrib/scrlttr2copy/letter-copy-test.pdf and b/macros/latex/contrib/scrlttr2copy/letter-copy-test.pdf differ diff --git a/macros/latex/contrib/scrlttr2copy/letter-copy-test.tex b/macros/latex/contrib/scrlttr2copy/letter-copy-test.tex index 1669762527..6ff0819a9c 100644 --- a/macros/latex/contrib/scrlttr2copy/letter-copy-test.tex +++ b/macros/latex/contrib/scrlttr2copy/letter-copy-test.tex @@ -1,4 +1,4 @@ - +\listfiles \documentclass[% ,copy ,ngerman @@ -18,15 +18,18 @@ %\setkomavar*{copy}{Zweitschrift} +% It is possible to redefine the \LetterCopyMarker macro to have a different +% background for the copied pages. + \begin{document} -\setkomavar{subject}{Ihr Schreiben vom 11.\,5.\,2015} +\setkomavar{subject}{Ihr Schreiben vom 11.\,5.\,2015} \begin{letter}{% Ellen Bogen \\ Dorfstraße 1\\ 12345 Musterhausen -} +} \opening{Sehr geehrte Frau Bogen,} @@ -50,6 +53,6 @@ Dorfstraße 1\\ \closing{Mit freundlichen Grüßen} -\end{letter} +\end{letter} \end{document} -- cgit v1.2.3