% \iffalse meta-comment
%
% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.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 `maintained'.
%
% The Current Maintainer of this work is Martin Scharrer.
%
% This work consists of the files realboxes.dtx and realboxes.ins
% and the derived filebase realboxes.sty.
%
% \fi
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesFile{realboxes.dtx}
    [2011/08/08 v0.2 DTX file]
\documentclass{ydoc}
\usepackage{realboxes}[2011/08/08]
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\OnlyDescription
\optionaloff
\begin{document}
  \DocInput{realboxes.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{545}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v0.1}{2011/08/04}{First release.}
% \changes{v0.2}{2011/08/08}{Fixed \cs{Savebox}. Added much more documentation.}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \GetFileInfo{realboxes.dtx}
% \title{The \textsf{realboxes} package}
% \author{Martin Scharrer \\ \url{martin@scharrer-online.de}}
% \date{\fileversion~from \filedate}
%
% \maketitle
% \begin{abstract}
% Provides variants of common ``box''-macros which reads their content as real box and not as macro argument.
% \end{abstract}
%
% \section{Introduction}
% The \LaTeX\ core and several packages like \pkg{graphics/x} provide
% some \cs{<xxx>box} macros which modify their content by first placing it into a box.
% However, these macros still read their content as a macro argument and therefore
% do no support verbatim content. This package provides variants of these macros
% which use the authors other package \pkg{collectbox} to collect the content
% as real box before it is modified (framed, raised, scaled, rotated, etc.).
% This allows for verbatim and other special content.
%
% The provided macros simply have the same names as the original versions but
% start with an upper-case letter instead.
% However, these macros do not support the special \env{picture} syntax as the original macros.
% The ``long-form'' macros, like \Macro\Makebox, can also be used as environments, but
% not the ``short-form'' macros, like \Macro\Mbox. However, normally the long form uses
% the short form anyway when no optional arguments are used.
%
% \subsection*{Length values}
% Some of the macros await length values to specify a dimension of the content.
% For all macros the lengths \Macro\width, \Macro\height, \Macro\depth and \Macro\totalheight\relax
% (= height + depth) can be used to refer to the original dimensions of the content.
% Also the \pkg{adjcalc} package from the \pkg{adjustbox} bundle is used to allow for
% mathematical expressions for these values. By default the $\epsilon$-\TeX\ primitive
% \Macro\dimexpr is used which allows for |+|, |-|, |*| and |/| as well as grouping using |( )|.
% If either $\epsilon$-\TeX\ or the \pkg{adjcalc} package is not available, than the \pkg{calc}
% package is used by default. It is also possible to use the \pkg{pgfmath} framework of the 
% \pkg{pgf} bundle.  To select a different math back-end simply load the \pkg{adjcalc} package
% with one of the options `|etex|', `|calc|', `|pgfmath|' or `|none|' before the \pkg{realboxes} package.  See the
% \pkg{adjustbox} manual for more information about \pkg{adjcalc}.
%
%
% \section{Usage}
% The following macros are provided dependent on the used package options.
% The options state other packages which are loaded and variants of their box macros are provided.
% See the package manual for more details about these macros.
% If loaded without any options the \opt{core} macros are loaded as well as all
% variant of macros for all already loaded packages (``auto-detection mode'').
%
%
% \subsection{\LaTeX\ code macros (option \opt{core})}
%
% \DescribeMacro{\Mbox}{<content>}
% This variant of \Macro\mbox is the only macro which doesn't use \Macro\collectbox
% because of the simplicity of the original macro. \Macro\Mbox will use \Macro\hbox
% directly to process the \marg{content} (and will expand it to search for the opening brace).
% The special case when \marg{content} is a single token is handling by using \Macro\mbox instead.
%
%
% \DescribeMacro{\Makebox}[<width>][<position>]{<content>}
% Places the \meta{content} in a box of width \meta{width} (by default the native width) and horizontally aligns it
% accordantly to \meta{position}. Valid values are |l| for left, |r| for right and |c| for center alignment (default).
% If no optional arguments are used this macro equals to \Macro\Mbox.
%
%
% \DescribeMacro{\Fbox}{<content>}
% Draws a frame around \meta{content} with a line width of \Macro\fboxrule and a separation of \Macro\fboxsep.
% The baseline of the content is not affected.
%
%
% \DescribeMacro{\Framebox}[<width>][<position>]{<content>}
% Like \Macro\Makebox but draws a frame like \Macro\Fbox.
% If no optional arguments are used this macro equals to \Macro\Fbox.
%
% \DescribeMacro{\Frame}{<content>}
% Similar to \Macro\Fbox but does draw the frame tightly around its content with no separation. The resulting box will also have no depth, i.e.
% might be moved up. Note that the original \Macro\frame macro is indented for use inside a \env{picture} environment but can also be used in
% normal text. The line width is the current \env{picture} line width (|\@wholewidth|) which can be (globally) set 
% using \Macro\linethickness{<length>} (also in normal text mode). 
%
%
%
%
% \DescribeMacro{\Raisebox}{<length>}[<height>][<depth>]{<content>}
% Raises the \meta{content} by \meta{length}. Negative values lower the content.
% In addition to this the official height and depth can be set. This does not scale the content,
% but only make \TeX\ reserve less vertical space.
%
%
% \DescribeMacro{\Centerline}{<content>}
% Places \meta{content} into a box of width \Macro\linewidth and centers it inside this box (even if the content is wider).
% This is similar to \Macro\Makebox[\AlsoMacro\linewidth][c]{<content>}.
%
%
% \DescribeMacro{\Leftline}{<content>}
% Places \meta{content} into a box of width \Macro\linewidth and left aligns it inside this box.
% If the content is wider it will stick out on the right site.
% This is similar to \Macro\Makebox[\AlsoMacro\linewidth][l]{<content>}.
%
%
% \DescribeMacro{\Rightline}{<content>}
% Places \meta{content} into a box of width \Macro\linewidth and right aligns it inside this box.
% If the content is wider it will stick out on the left site.
% This is similar to \Macro\Makebox[\AlsoMacro\linewidth][r]{<content>}.
%
%
% \DescribeMacro{\Rlap}{<content>}
% Places \meta{content} into a box of zero width so that it laps over to the right site. The following material to the right will be printed
% on top of it.
% This is similar to \Macro\Makebox['0pt'][l]{<content>}.
%
% \DescribeMacro{\Llap}{<content>}
% Places \meta{content} into a box of zero width so that it laps over to the left site. The content will be printed on top of the
% previous material on the left.
% This is similar to \Macro\Makebox['0pt'][l]{<content>}.
%
%
% \DescribeMacro{\Parbox}[<pos>][<height>][<inner-pos>]{<width>}{<content>}
% Places the \meta{content} into a paragraph box of the given \meta{width}.
% The optional \meta{pos} argument can be used to select the vertical alignment of the box towards the surrounding:
% `|t|' align box to the top baseline, `|b|' align to the bottom
% baseline or `|c|' vertically center the content.
% In addition to this the \meta{height} and the \meta{inner pos}ition can be set as further optional arguments.
% Valid values for \meta{inner-pos} are: `|t|' flush content to the top, `|b|' flush content to the bottom,
% `|c|' center the content inside the box or `|s|' to stretch the material vertically across the box. This only works if the content contains
% something vertically stretchable.
%
% This macro uses also \pkg{collectbox} but redefines an internal macro to collect a vertical box instead of the usual horizontal one.
%
%
% \DescribeMacro{\Sbox}{<\textbackslash boxregister>}{<content>}
% This saves the \meta{content} into the given \meta{\textbackslash boxregister}, which must be first allocated
% using \Macro\newsavebox{<\textbackslash boxregister>}.
%
% \DescribeMacro{\Savebox}{<\textbackslash boxregister>}[<width>][<position>]{<content>}
% Sets the \meta{content} in a box of the given width and alignment like \Macro\Makebox and stores it in \meta{\textbackslash boxregister}.
% If no optional arguments are used this macro equals to \Macro\Sbox.
%
% \Needspace*{10\baselineskip}
% \subsection{Color macros (option \opt{color} or \opt{xcolor})}
% \DescribeMacro{\Colorbox}[<color model>]{<color>}{<content>}
% Sets the \meta{content} into a box with the given background \meta{color}. If required the \meta{color model} can be specified.
%
% \DescribeMacro{\Fcolorbox}[<fc model>]{<frame color>}[<bg model>]{<background color>}{<content>}
% Sets the \meta{content} into a box with the given \meta{background color} and draws a frame around it like \Macro\Fbox but with
% a given \meta{frame color}.
% If required the color \meta{model} can be specified. If only the frame color model is specified it will also be used for the background color.
%
%
% \Needspace*{6\baselineskip}
% \subsection{Graphic macros (option \opt{graphics} or \opt{graphicx})}
% \DescribeMacro{\Rotatebox}[<options>]{<angle>}{<content>}
% Rotates the \meta{content} by \meta{angle} which is be default in degrees anti-clockwise (360 = full circle).
% As \meta{options} the following keys can be used:
% \begin{description}\def\oitem#1#2{\item[{\normalfont\ttfamily \MacroArgs'#1='<#2>\relax}]}%
%  \oitem{x}{dimen}
%  \oitem{y}{dimen}  Allows to specify the X and Y coordinate of the coordinate of the center of rotation relative to the reference point
%                    of the box.
%  \oitem{origin}{label} Allows to specify the center of the rotation using the following letters which can be combined: `|l|' left side,
%       `|r|' right side, `|c|' center of the box, `|t|' top of the box, `|b|' bottom of the box and `|B|' for the base line.
%       For example `|tr|' rotates about the top right corner.
%  \oitem{units}{number} allows to change the default units of degrees anti-clockwise (|360|) to any \meta{number} of units in one full
%       anti-clockwise rotation. For example |-360| specifies degrees clockwise and |6.283185| specifies radians.
% \end{description}
%
%
% \DescribeMacro{\Scalebox}{<h-scale>}[<v-scale>]{<content>}
% Scales the \meta{content} by the given \meta{scale} factor. The vertical scaling can be specified independently using the optional argument.
%
%
% \DescribeMacro{\Reflectbox}{<content>}
% This reflects the \meta{content} and is equal to \Macro\Scalebox{-1}{1}{<content>}.
%
%
% \DescribeMacro{\Resizebox}{<width>}{<height>}{<content>}
% Resizes the \meta{content} to the given \meta{width} and/or \meta{height}.
% The special value `|!|' can be used for one of the two values to scale it accordantly to the other value.
% \Macro\Resizebox{'!'}{'!'}{<content>} will not change the size of the content.
% If both values are used the aspect ratio might be changed. This can be avoided (for the local \TeX\ group) using
% \Macro\setkeys{Gin}{keepaspectratio}. Then the content is scaled to the smaller of the two values.
%
% \DescribeMacro{\Resizebox}'*'{<width>}{<totalheight>}{<content>}
% Like \Macro\Resizebox but scales the total height (= height + depth) instead of the height.
%
%
% \subsection{Macros of the \pkg{dashbox} package (option \opt{dashbox})}
%
% \DescribeMacro{\Dbox}{<content>}
% Like \Macro\Fbox but uses a dashed line instead.
%
% \DescribeMacro{\Dashbox}[<width>][<position>]{<content>}
% Like \Macro\Framebox but uses a dashed line instead.
%
% \DescribeMacro{\Lbox}[<layers>]{<content>}
% Draws some solid background layers to the lower right of the content which produces a shadow effect.
% The \meta{content} is supposed to also use \Macro\Dbox or \Macro\Fbox to draw the foreground dash or frame box.
% By default two layers are drawn but this can be changed by the optional argument.
%
% \DescribeMacro{\Dlbox}[<layers>]{<content>}
% Like \Macro\Lbox but draws the layers with dashed lines instead.
%
%
% \subsection{Compatibility with the \pkg{fancybox} package (option \opt{fancybox})}
% The \pkg{fancybox} package defines its macros already in a verbatim compatible way.
% However, if this option is used the \Macro\Sbox macro provided by the \opt{core} option is defined in a way to not 
% collide with the \opt{Sbox} environment of this package.
%
% \StopEventually{}
%
% \clearpage
% \section{Implementation}
%
% \iffalse
%<*realboxes.sty>
% \fi
% \subsection{Package Header and Options}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{realboxes}[2011/08/08 v0.2 Change box commands to read there content as real boxes]
\newif\ifrealboxes@core
\newif\ifrealboxes@xcolor
\newif\ifrealboxes@color
\newif\ifrealboxes@graphicx
\newif\ifrealboxes@graphics
\newif\ifrealboxes@dashbox
\newif\ifrealboxes@fancybox
\DeclareOption{all}{%
    \realboxes@coretrue
    \realboxes@xcolortrue
    \realboxes@colortrue
    \realboxes@graphicxtrue
    \realboxes@graphicstrue
    \realboxes@dashboxtrue
    \realboxes@fancyboxtrue
}
\DeclareOption*{%
    \begingroup
    \expandafter\ifx\csname realboxes@\CurrentOption true\endcsname\relax
        \endgroup
        \@unknownoptionerror
    \else
        \endgroup
        \csname realboxes@\CurrentOption true\endcsname
    \fi
}
\ProcessOptions\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\edef\@tempa{\@ptionlist{\@currname.\@currext}}
\ifx\@tempa\empty
    \realboxes@coretrue
    \@ifpackageloaded{dashbox}{\realboxes@dashboxtrue}{}
    \@ifpackageloaded{color}{\realboxes@colortrue}{}
    \@ifpackageloaded{xcolor}{\realboxes@xcolortrue}{}
    \@ifpackageloaded{graphics}{\realboxes@graphicstrue}{}
    \@ifpackageloaded{graphicx}{\realboxes@graphicxtrue}{}
    \@ifpackageloaded{fancybox}{\realboxes@fancyboxtrue}{}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\ifrealboxes@fancybox
    \realboxes@coretrue
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage{collectbox}
%    \end{macrocode}
%
%    \begin{macrocode}
\IfFileExists{adjcalc.sty}{%
    \RequirePackage{adjcalc}
}{%
    \RequirePackage{calc}
    \def\adjsetlength{\setlength}
}
%    \end{macrocode}
%
% \subsection{\LaTeX\ core}
%    \begin{macrocode}
\ifrealboxes@core
%    \end{macrocode}
%
% \begin{macro}{\Makebox}
%    \begin{macrocode}
\newcommand*{\Makebox}{%
    \collectboxcheckenv{Makebox}%
    \@ifnextchar[%
        \@Makebox
        \mbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Makebox}
%    \begin{macrocode}
\def\@Makebox[#1]{%
    \@ifnextchar[%
        {\@iMakebox{#1}}%
        {\@iMakebox{#1}[c]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iMakebox}
%    \begin{macrocode}
\def\@iMakebox#1[#2]{%
    \@collectbox{%
        \let\@tempboxa\collectedbox
        \adjsetlength\@tempdima{#1}%
        \hb@xt@\@tempdima{\csname bm@#2\endcsname}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Fbox}
%    \begin{macrocode}
\newcommand*\Fbox{%
    \collectbox@{\kern\fboxsep}{\let\@tempboxa\collectedbox\@frameb@x\relax}{\kern\fboxsep}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Frame}
%    \begin{macrocode}
\newcommand*\Frame{%
    \@collectbox{\frame\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Mbox}
%    \begin{macrocode}
\newcommand*\Mbox{%
    \leavevmode
    \@ifnextchar\bgroup
        \hbox
        \mbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Raisebox}
%    \begin{macrocode}
\newcommand*\Raisebox[1]{%
    \leavevmode
    \collectboxcheckenv{Raisebox}%
    \@ifnextchar[%
        {\@Rsbox{#1}}%
        {\@collectbox{\@iRsbox{#1}{}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Rsbox}
%    \begin{macrocode}
\def\@Rsbox#1[#2]{%
    \@ifnextchar[%
        {\@iiRsbox{#1}{#2}}%
        {\@collectbox{\@iRsbox{#1}{#2}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iRsbox}
%    \begin{macrocode}
\def\@iRsbox#1#2{%
    \adjsetlength\@tempdima{#1}%
    \ifx \\#2\\\else
        \adjsetlength\@tempdimb{#2}%
    \fi
    \setbox\collectedbox\hbox{\raise\@tempdima\box\collectedbox}%
    \ifx \\#2\\\else
        \ht\collectedbox\@tempdimb
    \fi
    \box\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiRsbox}
%    \begin{macrocode}
\def\@iiRsbox#1#2[#3]{%
    \@collectbox{\@iiiRsbox{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiiRsbox}
%    \begin{macrocode}
\def\@iiiRsbox#1#2#3{%
    \adjsetlength\@tempdima{#1}%
    \adjsetlength\@tempdimb{#2}%
    \adjsetlength\dimen@{#3}%
    \setbox\collectedbox\hbox{\raise\@tempdima\box\collectedbox}%
    \ht\collectedbox\@tempdimb
    \dp\collectedbox\dimen@
    \box\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Leftline}
%    \begin{macrocode}
\newcommand*\Leftline{\nocollectbox@to\linewidth{}{}\hss}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Rightline}
%    \begin{macrocode}
\newcommand*\Rightline{\nocollectbox@to\linewidth\hss{}{}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Centerline}
%    \begin{macrocode}
\newcommand*\Centerline{\nocollectbox@to\linewidth\hss{}\hss}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Rlap}
%    \begin{macrocode}
\newcommand*\Rlap{\nocollectbox@to\z@{}{}\hss}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Llap}
%    \begin{macrocode}
\newcommand*\Llap{\nocollectbox@to\z@\hss{}{}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Framebox}
%    \begin{macrocode}
\newcommand*\Framebox{%
    \collectboxcheckenv{Framebox}%
    \@ifnextchar[%
        \@Framebox
        \Fbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Framebox}
%    \begin{macrocode}
\def\@Framebox[#1]{%
  \@ifnextchar[%
    {\@iFramebox{#1}}%
    {\@iFramebox{#1}[c]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iFramebox}
%    \begin{macrocode}
\def\@iFramebox#1[#2]{%
    \@collectbox{\@iiFramebox{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiFramebox}
%    \begin{macrocode}
\def\@iiFramebox#1#2{%
    \let\@tempboxa\collectedbox
    \adjsetlength\@tempdima{#1}%
    \setbox\@tempboxa\hb@xt@\@tempdima
         {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
    \@frameb@x{\kern-\fboxrule}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Parbox}
%    \begin{macrocode}
\newcommand\Parbox{%
  \collectboxcheckenv{Parbox}%
  \@ifnextchar[%
    \@iParbox
    {\@iiiParbox c\relax[s]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iParbox}
%    \begin{macrocode}
\def\@iParbox[#1]{%
  \@ifnextchar[%
    {\@iiParbox{#1}}%
    {\@iiiParbox{#1}\relax[s]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiParbox}
%    \begin{macrocode}
\def\@iiParbox#1[#2]{%
  \@ifnextchar[%
    {\@iiiParbox{#1}{#2}}%
    {\@iiiParbox{#1}{#2}[#1]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiiParbox}
%    \begin{macrocode}
\def\@iiiParbox#1#2[#3]#4{%
  \leavevmode
  \begingroup
  \@pboxswfalse
  \adjsetlength\@tempdima{#4}%
  \let\collect@box\vbox
  \let\@tempboxa\collectedbox
  \collectbox@{\hsize\@tempdima\@parboxrestore}{\@vParbox{#1}{#2}{#3}}{\@@par}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@vParbox}
%    \begin{macrocode}
\def\@vParbox#1#2#3{%
    \ifx\relax#2\else
      \adjsetlength\@tempdimb{#2}%
      \edef\@parboxto{to\the\@tempdimb}%
    \fi
    \if#1b\vbox
    %\else\if #1B\vbox
    \else\if #1t\vtop
    %\else\if #1T\vtop
    \else\ifmmode\vcenter
    \else\@pboxswtrue $\vcenter
    \fi\fi\fi
    %\fi\fi
    \@parboxto{\let\hss\vss\let\unhbox\unvbox
       \csname bm@#3\endcsname}%
    \if@pboxsw \m@th$\fi
  \endgroup
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Sbox@}
%    \begin{macrocode}
\newcommand*\Sbox@[1]{\@collectboxto{#1}{}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Savebox}
%    \begin{macrocode}
\def\Savebox#1{%
  \@ifnextchar[%
    {\@Savebox#1}%
    {\Sbox@#1}%
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{\pkg{fancybox} Compatibility}
%
%    \begin{macrocode}
\ifrealboxes@fancybox
\RequirePackage{fancybox}
\let\orig@fancy@Sbox\Sbox
%    \end{macrocode}
%
% \begin{macro}{\Sbox}
%    \begin{macrocode}
\def\Sbox{%
    \begingroup
    \def\@tempa{Sbox}%
    \expandafter\endgroup
    \ifx\@currenvir\@tempa
        \orig@fancy@Sbox
        \edef\@currenvir{\@currenvir\space}%
    \else
        \expandafter\Sbox@
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\else
\let\Sbox\Sbox@
\AtBeginDocument{\@ifpackageloaded{fancybox}{%
    \PackageWarning{realboxes}{Package 'fancybox' got loaded. This requires 'realboxes' to be loaded with the 'fancybox' option!}%
}{}}%
\fi
%    \end{macrocode}
%
% \begin{macro}{\@Savebox}
%    \begin{macrocode}
\def\@Savebox#1[#2]{%
  \@ifnextchar [%
    {\@iSavebox#1{#2}}%
    {\@iSavebox#1{#2}[c]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iSavebox}
%    \begin{macrocode}
\def\@iSavebox#1#2[#3]{%
    \@collectboxto#1{\@iiSavebox{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iiSavebox}
%    \begin{macrocode}
\def\@iiSavebox#1#2#3{%
    \sbox#1{%
        \let\@tempboxa#1%
        \adjsetlength\@tempdima{#2}%
        \hb@xt@\@tempdima{\csname bm@#3\endcsname}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsection{\pkg{color} and \pkg{xcolor} Packages}
%    \begin{macrocode}
\ifrealboxes@xcolor
    \RequirePackage{xcolor}
    \realboxes@colortrue
\else
  \ifrealboxes@color
    \RequirePackage{color}
  \fi
\fi
\ifrealboxes@color
%    \end{macrocode}
%
% \begin{macro}{\Colorbox}
%    \begin{macrocode}
\newcommand*\Colorbox{}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Colorbox}
%    \begin{macrocode}
\def\Colorbox#1#{%
    \collectboxcheckenv{Colorbox}%
    \Color@box{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Color@box}
%    \begin{macrocode}
\def\Color@box#1#2{%
    \@collectbox{\color@box{#1}{#2}\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Fcolorbox}
%    \begin{macrocode}
\newcommand*\Fcolorbox{}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Fcolorbox}
%    \begin{macrocode}
\def\Fcolorbox#1#{%
    \collectboxcheckenv{Fcolorbox}%
    \Color@fbox{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Color@fbox}
%    \begin{macrocode}
\def\Color@fbox#1#2#3#{%
    \Color@@fbox{#1}{#2}{#3}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Color@@fbox}
%    \begin{macrocode}
\def\Color@@fbox#1#2#3#4{%
    \protect\@collectbox{\protect\color@fb@x{#1}{#2}{#3}{#4}\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsection{\pkg{color} and \pkg{xcolor} Packages}
%    \begin{macrocode}
\ifrealboxes@graphicx
    \RequirePackage{graphicx}
    \realboxes@graphicstrue
\else
  \ifrealboxes@graphics
    \RequirePackage{graphics}
  \fi
\fi
\ifrealboxes@graphics
%    \end{macrocode}
%
% \begin{macro}{\Rotatebox}
%    \begin{macrocode}
\newcommand*\Rotatebox{%
    \collectboxcheckenv{Rotatebox}%
    \@ifnextchar[%
        \Rotatebox@kv
        \Rotatebox@std
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Rotatebox@kv}
%    \begin{macrocode}
\def\Rotatebox@kv[#1]#2{%
    \@collectbox{\Grot@box@kv[#1]{#2}\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Rotatebox@std}
%    \begin{macrocode}
\def\Rotatebox@std#1{%
    \@collectbox{\Grot@box@std{#1}\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Scalebox}
%    \begin{macrocode}
\newcommand*\Scalebox[1]{%
    \collectboxcheckenv{Scalebox}%
    \@ifnextchar[%
        {\Scale@box{#1}}%
        {\Scale@box{#1}[#1]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Scale@box}
%    \begin{macrocode}
\def\Scale@box#1[#2]{%
    \@collectbox{\Gscale@box{#1}[#2]\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Reflectbox}
%    \begin{macrocode}
\newcommand*\Reflectbox{%
    \collectboxcheckenv{Reflectbox}%
    \Scale@box{-1}[1]%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Resizebox}
%    \begin{macrocode}
\newcommand*\Resizebox{%
    \collectboxcheckenv{Resizebox}%
    \@ifstar
        {\@Resizebox\totalheight}%
        {\@Resizebox\height}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Resizebox}
%    \begin{macrocode}
\@namedef{Resizebox*}{%
    \@collectboxisenv{Resizebox*}%
    \@Resizebox\totalheight
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@Resizebox}
%    \begin{macrocode}
\def\@Resizebox#1#2#3{%
    \@collectbox{\let\setlength\adjsetlength\Gscale@@box{#1}{#2}{#3}\BOXCONTENT}%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%
% \subsection{\pkg{dashbox} Package}
%    \begin{macrocode}
\ifrealboxes@dashbox
\RequirePackage{dashbox}
%    \end{macrocode}
%
% \begin{macro}{\Dbox}
%    \begin{macrocode}
\newcommand*\Dbox{%
    \@collectbox{\dbox{\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Dashbox}
%    \begin{macrocode}
\newcommand*\Dashbox{%
    \@ifnextchar[%
        \@Dashbox
        \Dbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Dashbox}
%    \begin{macrocode}
\def\@Dashbox[#1]{%
    \@ifnextchar[%
        {\@iDashbox{#1}}%
        {\@iDashbox{#1}[c]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@iDashbox}
%    \begin{macrocode}
\def\@iDashbox#1[#2]{%
    \@collectbox{\dashbox[#1][#2]{\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Lbox}
%    \begin{macrocode}
\newcommand*\Lbox{%
    \@ifnextchar[%
        \@Lbox
        {\@collectbox{\lbox{\BOXCONTENT}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Lbox}
%    \begin{macrocode}
\def\@Lbox[#1]{%
    \@collectbox{\lbox[#1]{\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Dlbox}
%    \begin{macrocode}
\newcommand*\Dlbox{%
    \@ifnextchar[%
        \@Dlbox
        {\@collectbox*\dlbox}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@Dlbox}
%    \begin{macrocode}
\def\@Dlbox[#1]{%
    \@collectbox{\dlbox[#1]{\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%
% \iffalse
%</realboxes.sty>
% \fi
%
% \Finale
\endinput