summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/scrlttr2copy/copy.lco
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/scrlttr2copy/copy.lco')
-rw-r--r--macros/latex/contrib/scrlttr2copy/copy.lco76
1 files changed, 76 insertions, 0 deletions
diff --git a/macros/latex/contrib/scrlttr2copy/copy.lco b/macros/latex/contrib/scrlttr2copy/copy.lco
new file mode 100644
index 0000000000..e3213a9f24
--- /dev/null
+++ b/macros/latex/contrib/scrlttr2copy/copy.lco
@@ -0,0 +1,76 @@
+
+%% Copyright (C) 2015
+%% Rolf Niepraschk, Rolf.Niepraschk@gmx.de
+%%
+%% 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.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "author-maintained".
+
+\ProvidesFile{copy.lco}[2015/05/31 v0.1d copy letter-class-option (RN)]
+
+\RequirePackage{atbegshi,picture,xcolor,graphicx}
+\RequirePackage{etex}
+
+\newcounter{copy@pages}
+
+\AtBeginLetter{\shipout@copy}
+\AtEndDocument{\shipout@copy}
+
+\newcommand*\shipout@copy{%
+ \if@twoside\ifodd\c@copy@pages
+ \@latex@info@no@line{Shipout an empty page}%
+ \AtBeginShipoutOriginalShipout\null
+ \fi\fi
+ \immediate\closeout\@mainaux
+ \immediate\openout\@mainaux\jobname.aux
+ \begingroup
+ \c@page=\z@
+ \loop\ifnum\c@page<\c@copy@pages
+ \advance\c@page\@ne
+ \@latex@info@no@line{Shipout copy of page \the\c@page}%
+ \setbox\AtBeginShipoutBox=\box\csname out@box\the\c@page\endcsname
+ \AtBeginShipoutUpperLeft{\LetterCopyMarker}%
+ \AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox
+ \repeat
+ \endgroup
+ \c@copy@pages=\z@
+}
+
+\AtBeginShipout{%
+ \@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}%
+ \global\setbox\csname out@box\the\c@page\endcsname=\copy\AtBeginShipoutBox
+ \global\c@copy@pages=\c@page
+}
+
+\newcommand*\LetterCopyMarker{%
+ \put(0.5\paperwidth,-0.5\paperheight){%
+ \makebox(0,0)[c]{\resizebox{\textwidth}{!}{\rotatebox{45}{%
+ \textsf{\textbf{\color{lightgray}\strut\usekomavar*{copy}}}}}}%
+ }%
+}
+
+\newkomavar[\copyname]{copy}
+\newcommand*\copyname{Copy}
+
+\defcaptionname{american,australian,british,canadian,%
+ english,newzealand,UKenglish,USenglish}\copyname{Copy}%
+\defcaptionname{german,ngerman,austrian,naustrian,%
+ swissgerman,nswissgerman}\copyname{Kopie}
+\defcaptionname{acadian,canadien,francais,french}\copyname{Copie}
+\defcaptionname{spanish,italian,portugese}\copyname{Copia}
+\defcaptionname{polish}\copyname{Kopia}
+\defcaptionname{russian}\copyname{Копия}
+
+\endinput