%%
%% 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'.
