summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stubs/stubs.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/stubs/stubs.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/stubs/stubs.sty')
-rw-r--r--macros/latex/contrib/stubs/stubs.sty111
1 files changed, 111 insertions, 0 deletions
diff --git a/macros/latex/contrib/stubs/stubs.sty b/macros/latex/contrib/stubs/stubs.sty
new file mode 100644
index 0000000000..e39cd8538c
--- /dev/null
+++ b/macros/latex/contrib/stubs/stubs.sty
@@ -0,0 +1,111 @@
+% This file is part of stubs.
+%
+% stubs is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2 of the License, or
+% (at your option) any later version.
+%
+% Stubs is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Foobar; if not, write to the Free Software
+% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+%
+%
+% Version 0.1.1
+%
+% Changelog:
+%
+% see changelog.txt
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{stubs}[2005/12/16 Stubs 0.1.1 by N. Stuhrmann]
+
+\RequirePackage[absolute]{textpos}[2005/10/13]
+\RequirePackage{graphicx}[1999/02/16]
+
+\DeclareOption{addmargin}{\newcommand*\st@addmargin{\relax}}%
+
+\ProcessOptions
+
+\newlength{\stubbmargin}
+\setlength{\stubbmargin}{5mm}
+
+\newlength{\stublmargin}
+\setlength{\stublmargin}{5mm}
+
+\newlength{\stubrmargin}
+\setlength{\stubrmargin}{5mm}
+
+\newcommand{\stubs}[2][0]{%
+\def\st@number{#1}%
+\def\st@size{#2}%
+\st@b
+}
+
+\newcommand{\st@b}[2][\empty]{%
+ {%
+ \unitlength=1pt\relax
+ \@tempdima=\paperheight\relax
+ \@tempdimb=\paperwidth\relax
+ \advance\@tempdimb by -\stublmargin\relax
+ \advance\@tempdimb by -\stubrmargin\relax
+ \textblockorigin{\stublmargin}{\paperheight}\relax
+ \setbox\@tempboxa=\vbox{\parbox[b]{\st@size}{#1}\parbox[b]{\st@size}{#2}}\relax
+ \count@=\st@number\relax
+ \@ifundefined{st@addmargin}%
+ {}%
+ {\enlargethispage{-\st@size}}%
+%\ifnum\count@=0\relax
+% \dimen@=\ht\@tempboxa\relax
+% \advance\dimen@ by 2\fboxsep\relax
+% {\divide\@tempdimb by \dimen@\relax
+% \global\count@=\@tempdimb}%
+%\fi%
+ \ifnum\count@=0\relax%
+ \dimen@=\ht\@tempboxa\relax%
+ \advance\dimen@ by 2\fboxsep\relax%
+ {\divide\@tempdimb by \dimen@\relax%
+ \expandafter}\expandafter\count@\expandafter=\number\@tempdimb
+ \fi%
+ \divide\@tempdimb by \count@\relax
+ \setbox\@tempboxa=\vtop to \@tempdimb %
+ {\vfill\hbox{\kern\fboxsep\parbox{\st@size}{#2}\kern\fboxsep}\vfill\hrule}\relax
+ \advance\@tempdima by -\wd\@tempboxa\relax
+ \begin{textblock}{0}(0,0)%
+ \noindent
+ \begin{picture}(0,0)%
+ \put(0,\strip@pt\stubbmargin){\vrule height \wd\@tempboxa}
+ \multiput(0,\strip@pt\stubbmargin)(\strip@pt\@tempdimb,0){\number\count@}{%
+ \rotatebox{90}{\copy\@tempboxa}%
+ }%
+ \end{picture}%
+ \end{textblock}\leavevmode%
+ \ifx\empty#1\else%
+ \newpage%
+ \thispagestyle{empty}%
+ \@ifundefined{st@addmargin}%
+ {}%
+ {\enlargethispage{-\st@size}}%
+ \textblockorigin{\stubrmargin}{\paperheight}\relax
+ \setbox\@tempboxa=\vtop to \@tempdimb %
+ {\vfill\hbox{\kern\fboxsep\parbox{\st@size}{#1}\kern\fboxsep}\vfill}\relax
+ \begin{textblock}{0}(0,0)%
+ \noindent
+ \begin{picture}(0,0)%
+ %\put(0,\strip@pt\stubbmargin){\vrule height \wd\@tempboxa}
+ \multiput(0,\strip@pt\stubbmargin)(\strip@pt\@tempdimb,0){\number\count@}{%
+ \rotatebox{90}{\copy\@tempboxa}%
+ }%
+ \end{picture}%
+ \end{textblock}\leavevmode%
+ \fi%
+ }%
+ \ignorespaces%
+}
+
+\endinput \ No newline at end of file