texlive[56733] Master/texmf-dist: scrlttr2copy (22oct20)

commits+karl at tug.org commits+karl at tug.org
Thu Oct 22 22:51:06 CEST 2020


Revision: 56733
          http://tug.org/svn/texlive?view=revision&revision=56733
Author:   karl
Date:     2020-10-22 22:51:06 +0200 (Thu, 22 Oct 2020)
Log Message:
-----------
scrlttr2copy (22oct20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/scrlttr2copy/README.md
    trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.pdf
    trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.tex
    trunk/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco

Modified: trunk/Master/texmf-dist/doc/latex/scrlttr2copy/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scrlttr2copy/README.md	2020-10-22 20:50:52 UTC (rev 56732)
+++ trunk/Master/texmf-dist/doc/latex/scrlttr2copy/README.md	2020-10-22 20:51:06 UTC (rev 56733)
@@ -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 @@
 
 For more details see the example document `letter-copy-test.tex`.
 
-[Rolf Niepraschk](mailto:Rolf.Niepraschk at 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
 
+

Modified: trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.tex	2020-10-22 20:50:52 UTC (rev 56732)
+++ trunk/Master/texmf-dist/doc/latex/scrlttr2copy/letter-copy-test.tex	2020-10-22 20:51:06 UTC (rev 56733)
@@ -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 @@
 
 \closing{Mit freundlichen Grüßen}
 
-\end{letter}
+\end{letter}   
 
 \end{document}

Modified: trunk/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco	2020-10-22 20:50:52 UTC (rev 56732)
+++ trunk/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco	2020-10-22 20:51:06 UTC (rev 56733)
@@ -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 at t@r\fmtversion}
 \IfFormatAtLeastTF{2020/10/01}{}{%
   \PackageError{copy.lco}{%
@@ -25,49 +25,20 @@
 
 \RequirePackage{xcolor,graphicx}
 
-\newcounter{copy at pages}
-
-\AtBeginLetter{\shipout at copy}% Output the copy of the pages of the previous letter
-\AtEndDocument{\shipout at copy}% Output the copy of the pages of the last letter
-
-\newcommand*\shipout at copy{%
-  \ifnum\c at copy@pages>\z@% ignore the following in the first \AtBeginLetter     
-    \RemoveFromHook{shipout/before}[CP at save]
-    \if at twoside\ifodd\c at copy@pages
-      \@latex at info@no at line{Shipout an empty page}%
-      \shipout\null
-    \fi\fi
-    \immediate\closeout\@mainaux
-    \immediate\openout\@mainaux\jobname.aux
-    \begingroup
-      \c at page=\z@
-      \AddToHook{shipout/background}[CP at marker]{\LetterCopyMarker}%
-      \loop\ifnum\c at page<\c at copy@pages
-        \advance\c at page\@ne
-        \@latex at info@no at line{Shipout copy of page \the\c at page}%
-        \setbox\ShipoutBox=\box\csname out at box\the\c at page\endcsname
-        \shipout\box\ShipoutBox
-      \repeat
-      \RemoveFromHook{shipout/background}[CP at marker]
-    \endgroup
-    \c at copy@pages=\z@
-  \fi
-  % Saving all pages of the next letter 
-  \AddToHook{shipout/before}[CP at save]{\save at page@copies}
+\AtEndLetter{% Saving the number of total pages of each letter in a separate macro
+  \expandafter\xdef\csname CP at max@pages@\the\c at letter\endcsname{\the\c at page}%
 }
 
-\newcommand*\save at page@copies{%
-  \@ifundefined{out at box\the\c at page}{%
-    \@latex at info@no at line{Alloc savebox for page \the\c at page}%
-    \expandafter\newsavebox\csname out at box\the\c at page\endcsname
-  }{%
-    \@latex at info@no at line{Savebox for page \the\c at page\space already exist}%
-  }%
-  \@latex at info@no at line{Save page \the\c at page\space to \string\out at box\the\c at page}%
-  \global\setbox\csname out at box\the\c at page\endcsname=\copy\ShipoutBox
-  \global\c at copy@pages=\c at page
+\newcommand*\save at page@copies{% Saving each output page in a separate box
+  \expandafter\newsavebox\csname page at box@\the\c at letter @\the\c at page\endcsname
+  \@latex at info@no at line{Save page \the\c at page\space of  letter \the\c at letter 
+    \space to \string\page at box@\the\c at letter @\the\c at page}%
+  \global\setbox\csname page at box@\the\c at letter @\the\c at page\endcsname=
+    \copy\ShipoutBox
 }
 
+\AddToHook{shipout/before}[CP at save]{\save at 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 at shipout]{%
+  \RemoveFromHook{shipout/before}[CP at save]%
+  \if at twoside\ifodd\ReadonlyShipoutCounter
+    \@latex at info@no at line{Output an empty page}%
+    \shipout\null
+  \fi\fi
+  \AddToHook{shipout/background}[CP at marker]{\LetterCopyMarker}%
+  \@tempcnta=\z@
+  \loop% iterate over all letters
+    \advance\@tempcnta\@ne
+    {%
+      \c at page=\z@
+      \edef\@tempa{\@nameuse{CP at max@pages@\the\@tempcnta}}% total pages
+      \loop% iterate over all pages of this letter
+        \advance\c at page\@ne
+        \@latex at info@no at line{Output of the copy of page \the\c at page\space 
+          of letter \the\@tempcnta}%
+        \setbox\ShipoutBox=\box\@nameuse{page at box@\the\@tempcnta @\the\c at page}%
+        \shipout\box\ShipoutBox
+      \ifnum \c at page < \@tempa
+      \repeat
+    }%
+  \ifnum \@tempcnta < \c at letter
+  \repeat
+  \RemoveFromHook{shipout/background}[CP at marker]
+  \RemoveFromHook{enddocument/afteraux}[CP at 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{Копия}



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