diff options
author | Karl Berry <karl@freefriends.org> | 2020-10-22 20:51:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-10-22 20:51:06 +0000 |
commit | da47113c029fe8407e6c7270d2a1763081240a67 (patch) | |
tree | 6759829c1bf2aca767a1bcc79147a66116084afc /Master/texmf-dist/tex/latex | |
parent | 61fb10ef8524429784dd835fee2523a635ed8580 (diff) |
scrlttr2copy (22oct20)
git-svn-id: svn://tug.org/texlive/trunk@56733 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco b/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco index 260d3c6eb8d..989449a59c4 100644 --- a/Master/texmf-dist/tex/latex/scrlttr2copy/copy.lco +++ b/Master/texmf-dist/tex/latex/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{Копия} |