summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/minidocument/minidocument.sty
blob: 5ed833cae0c45758ef11d5fd28aec107d1e0e040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
%%
%% This is file `minidocument.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% minidocument.dtx  (with options: `package')
%% 
%% Copyright 2017 Maurice Leclaire <leclaire@in.tum.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 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `author-maintained'.
%% 
%% This work consists of the files minidocument.dtx and minidocument.ins
%% and the derived file minidocument.sty.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{minidocument}[2017/04/11 v1.0 Mini Documents]
\RequirePackage{graphics}
\newbox\minidocument@box
\newbox\minidocument@aggrbox
\newbox\minidocument@hold
\newtoks\minidocument@orig@output
\def\minidocument@shipout{%
    \begingroup\setbox\minidocument@box\hbox\bgroup\kern\p@%
    \afterassignment\minidocument@testshipout%
    \global\setbox\minidocument@box%
}
\def\minidocument@testshipout{%
    \ifdim\lastkern=\z@%
        \expandafter\aftergroup%
    \fi%
    \minidocument@makeshipout%
}
\def\minidocument@makeshipout{%
    \egroup\endgroup%
    \ifvoid\minidocument@box\else%
        \global\setbox\minidocument@box\vbox to \paperheight {
            \vskip1in%
            \hbox to \paperwidth {
                \hskip1in%
                \box\minidocument@box%
                \hfill
            }%
            \vfill
        }%
        \global\setbox\minidocument@aggrbox\hbox{\unhbox\minidocument@aggrbox%
            \minidocumentshipout{\box\minidocument@box}%
            \hskip0pt%
        }%
    \fi%
}
\newenvironment{minidocument}{%
    \minidocument@orig@output\output%
    \output{\global\setbox\minidocument@hold\box\@cclv}%
    \penalty-\@Mi%
    \output\minidocument@orig@output%
    \let\minidocument@orig@shipout\shipout%
    \let\shipout\minidocument@shipout%
    \edef\minidocument@page{\the\c@page}%
    \c@page\@ne%
}{%
    \clearpage%
    \let\shipout\minidocument@orig@shipout%
    \global\c@page\minidocument@page%
    \unvbox\minidocument@hold%
}
\def\lastminidocument{%
    \unhbox\minidocument@aggrbox\unskip%
}

\def\minidocumentscale{0.333}
\newcommand{\minidocumentshipout}[1]{%
    \scalebox{\minidocumentscale}{\frame{#1}}%
}
\endinput
%%
%% End of file `minidocument.sty'.