Debian Codegraph @

texmf-dist/source/latex/realboxes/realboxes.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2011 by Martin Scharrer <[email protected]>
4 % ---------------------------------------------------------------------------
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Martin Scharrer.
16 %
17 % This work consists of the files realboxes.dtx and realboxes.ins
18 % and the derived filebase realboxes.sty.
19 %
20 % \fi
21 %
22 % \iffalse
23 %<*driver>
24 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
25 \ProvidesFile{realboxes.dtx}
26 [2011/08/08 v0.2 DTX file]
27 \documentclass{ydoc}
28 \usepackage{realboxes}[2011/08/08]
29 \EnableCrossrefs
30 \CodelineIndex
31 \RecordChanges
32 \OnlyDescription
33 \optionaloff
34 \begin{document}
35 \DocInput{realboxes.dtx}
36 \PrintChanges
37 \PrintIndex
38 \end{document}
39 %</driver>
40 % \fi
41 %
42 % \CheckSum{545}
43 %
44 % \CharacterTable
45 % {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
46 % 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
47 % Digits \0\1\2\3\4\5\6\7\8\9
48 % Exclamation \! Double quote \" Hash (number) \#
49 % Dollar \$ Percent \% Ampersand \&
50 % Acute accent \' Left paren \( Right paren \)
51 % Asterisk \* Plus \+ Comma \,
52 % Minus \- Point \. Solidus \/
53 % Colon \: Semicolon \; Less than \<
54 % Equals \= Greater than \> Question mark \?
55 % Commercial at \@ Left bracket \[ Backslash \\
56 % Right bracket \] Circumflex \^ Underscore \_
57 % Grave accent \` Left brace \{ Vertical bar \|
58 % Right brace \} Tilde \~}
59 %
60 %
61 % \changes{v0.1}{2011/08/04}{First release.}
62 % \changes{v0.2}{2011/08/08}{Fixed \cs{Savebox}. Added much more documentation.}
63 %
64 % \DoNotIndex{\newcommand,\newenvironment}
65 %
66 % \providecommand*{\url}{\texttt}
67 % \GetFileInfo{realboxes.dtx}
68 % \title{The \textsf{realboxes} package}
69 % \author{Martin Scharrer \\ \url{[email protected]}}
70 % \date{\fileversion~from \filedate}
71 %
72 % \maketitle
73 % \begin{abstract}
74 % Provides variants of common ``box''-macros which reads their content as real box and not as macro argument.
75 % \end{abstract}
76 %
77 % \section{Introduction}
78 % The \LaTeX\ core and several packages like \pkg{graphics/x} provide
79 % some \cs{<xxx>box} macros which modify their content by first placing it into a box.
80 % However, these macros still read their content as a macro argument and therefore
81 % do no support verbatim content. This package provides variants of these macros
82 % which use the authors other package \pkg{collectbox} to collect the content
83 % as real box before it is modified (framed, raised, scaled, rotated, etc.).
84 % This allows for verbatim and other special content.
85 %
86 % The provided macros simply have the same names as the original versions but
87 % start with an upper-case letter instead.
88 % However, these macros do not support the special \env{picture} syntax as the original macros.
89 % The ``long-form'' macros, like \Macro\Makebox, can also be used as environments, but
90 % not the ``short-form'' macros, like \Macro\Mbox. However, normally the long form uses
91 % the short form anyway when no optional arguments are used.
92 %
93 % \subsection*{Length values}
94 % Some of the macros await length values to specify a dimension of the content.
95 % For all macros the lengths \Macro\width, \Macro\height, \Macro\depth and \Macro\totalheight\relax
96 % (= height + depth) can be used to refer to the original dimensions of the content.
97 % Also the \pkg{adjcalc} package from the \pkg{adjustbox} bundle is used to allow for
98 % mathematical expressions for these values. By default the $\epsilon$-\TeX\ primitive
99 % \Macro\dimexpr is used which allows for |+|, |-|, |*| and |/| as well as grouping using |( )|.
100 % If either $\epsilon$-\TeX\ or the \pkg{adjcalc} package is not available, than the \pkg{calc}
101 % package is used by default. It is also possible to use the \pkg{pgfmath} framework of the
102 % \pkg{pgf} bundle. To select a different math back-end simply load the \pkg{adjcalc} package
103 % with one of the options `|etex|', `|calc|', `|pgfmath|' or `|none|' before the \pkg{realboxes} package. See the
104 % \pkg{adjustbox} manual for more information about \pkg{adjcalc}.
105 %
106 %
107 % \section{Usage}
108 % The following macros are provided dependent on the used package options.
109 % The options state other packages which are loaded and variants of their box macros are provided.
110 % See the package manual for more details about these macros.
111 % If loaded without any options the \opt{core} macros are loaded as well as all
112 % variant of macros for all already loaded packages (``auto-detection mode'').
113 %
114 %
115 % \subsection{\LaTeX\ code macros (option \opt{core})}
116 %
117 % \DescribeMacro{\Mbox}{<content>}
118 % This variant of \Macro\mbox is the only macro which doesn't use \Macro\collectbox
119 % because of the simplicity of the original macro. \Macro\Mbox will use \Macro\hbox
120 % directly to process the \marg{content} (and will expand it to search for the opening brace).
121 % The special case when \marg{content} is a single token is handling by using \Macro\mbox instead.
122 %
123 %
124 % \DescribeMacro{\Makebox}[<width>][<position>]{<content>}
125 % Places the \meta{content} in a box of width \meta{width} (by default the native width) and horizontally aligns it
126 % accordantly to \meta{position}. Valid values are |l| for left, |r| for right and |c| for center alignment (default).
127 % If no optional arguments are used this macro equals to \Macro\Mbox.
128 %
129 %
130 % \DescribeMacro{\Fbox}{<content>}
131 % Draws a frame around \meta{content} with a line width of \Macro\fboxrule and a separation of \Macro\fboxsep.
132 % The baseline of the content is not affected.
133 %
134 %
135 % \DescribeMacro{\Framebox}[<width>][<position>]{<content>}
136 % Like \Macro\Makebox but draws a frame like \Macro\Fbox.
137 % If no optional arguments are used this macro equals to \Macro\Fbox.
138 %
139 % \DescribeMacro{\Frame}{<content>}
140 % 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.
141 % 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
142 % normal text. The line width is the current \env{picture} line width (|\@wholewidth|) which can be (globally) set
143 % using \Macro\linethickness{<length>} (also in normal text mode).
144 %
145 %
146 %
147 %
148 % \DescribeMacro{\Raisebox}{<length>}[<height>][<depth>]{<content>}
149 % Raises the \meta{content} by \meta{length}. Negative values lower the content.
150 % In addition to this the official height and depth can be set. This does not scale the content,
151 % but only make \TeX\ reserve less vertical space.
152 %
153 %
154 % \DescribeMacro{\Centerline}{<content>}
155 % Places \meta{content} into a box of width \Macro\linewidth and centers it inside this box (even if the content is wider).
156 % This is similar to \Macro\Makebox[\AlsoMacro\linewidth][c]{<content>}.
157 %
158 %
159 % \DescribeMacro{\Leftline}{<content>}
160 % Places \meta{content} into a box of width \Macro\linewidth and left aligns it inside this box.
161 % If the content is wider it will stick out on the right site.
162 % This is similar to \Macro\Makebox[\AlsoMacro\linewidth][l]{<content>}.
163 %
164 %
165 % \DescribeMacro{\Rightline}{<content>}
166 % Places \meta{content} into a box of width \Macro\linewidth and right aligns it inside this box.
167 % If the content is wider it will stick out on the left site.
168 % This is similar to \Macro\Makebox[\AlsoMacro\linewidth][r]{<content>}.
169 %
170 %
171 % \DescribeMacro{\Rlap}{<content>}
172 % 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
173 % on top of it.
174 % This is similar to \Macro\Makebox['0pt'][l]{<content>}.
175 %
176 % \DescribeMacro{\Llap}{<content>}
177 % 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
178 % previous material on the left.
179 % This is similar to \Macro\Makebox['0pt'][l]{<content>}.
180 %
181 %
182 % \DescribeMacro{\Parbox}[<pos>][<height>][<inner-pos>]{<width>}{<content>}
183 % Places the \meta{content} into a paragraph box of the given \meta{width}.
184 % The optional \meta{pos} argument can be used to select the vertical alignment of the box towards the surrounding:
185 % `|t|' align box to the top baseline, `|b|' align to the bottom
186 % baseline or `|c|' vertically center the content.
187 % In addition to this the \meta{height} and the \meta{inner pos}ition can be set as further optional arguments.
188 % Valid values for \meta{inner-pos} are: `|t|' flush content to the top, `|b|' flush content to the bottom,
189 % `|c|' center the content inside the box or `|s|' to stretch the material vertically across the box. This only works if the content contains
190 % something vertically stretchable.
191 %
192 % This macro uses also \pkg{collectbox} but redefines an internal macro to collect a vertical box instead of the usual horizontal one.
193 %
194 %
195 % \DescribeMacro{\Sbox}{<\textbackslash boxregister>}{<content>}
196 % This saves the \meta{content} into the given \meta{\textbackslash boxregister}, which must be first allocated
197 % using \Macro\newsavebox{<\textbackslash boxregister>}.
198 %
199 % \DescribeMacro{\Savebox}{<\textbackslash boxregister>}[<width>][<position>]{<content>}
200 % Sets the \meta{content} in a box of the given width and alignment like \Macro\Makebox and stores it in \meta{\textbackslash boxregister}.
201 % If no optional arguments are used this macro equals to \Macro\Sbox.
202 %
203 % \Needspace*{10\baselineskip}
204 % \subsection{Color macros (option \opt{color} or \opt{xcolor})}
205 % \DescribeMacro{\Colorbox}[<color model>]{<color>}{<content>}
206 % Sets the \meta{content} into a box with the given background \meta{color}. If required the \meta{color model} can be specified.
207 %
208 % \DescribeMacro{\Fcolorbox}[<fc model>]{<frame color>}[<bg model>]{<background color>}{<content>}
209 % Sets the \meta{content} into a box with the given \meta{background color} and draws a frame around it like \Macro\Fbox but with
210 % a given \meta{frame color}.
211 % 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.
212 %
213 %
214 % \Needspace*{6\baselineskip}
215 % \subsection{Graphic macros (option \opt{graphics} or \opt{graphicx})}
216 % \DescribeMacro{\Rotatebox}[<options>]{<angle>}{<content>}
217 % Rotates the \meta{content} by \meta{angle} which is be default in degrees anti-clockwise (360 = full circle).
218 % As \meta{options} the following keys can be used:
219 % \begin{description}\def\oitem#1#2{\item[{\normalfont\ttfamily \MacroArgs'#1='<#2>\relax}]}%
220 % \oitem{x}{dimen}
221 % \oitem{y}{dimen} Allows to specify the X and Y coordinate of the coordinate of the center of rotation relative to the reference point
222 % of the box.
223 % \oitem{origin}{label} Allows to specify the center of the rotation using the following letters which can be combined: `|l|' left side,
224 % `|r|' right side, `|c|' center of the box, `|t|' top of the box, `|b|' bottom of the box and `|B|' for the base line.
225 % For example `|tr|' rotates about the top right corner.
226 % \oitem{units}{number} allows to change the default units of degrees anti-clockwise (|360|) to any \meta{number} of units in one full
227 % anti-clockwise rotation. For example |-360| specifies degrees clockwise and |6.283185| specifies radians.
228 % \end{description}
229 %
230 %
231 % \DescribeMacro{\Scalebox}{<h-scale>}[<v-scale>]{<content>}
232 % Scales the \meta{content} by the given \meta{scale} factor. The vertical scaling can be specified independently using the optional argument.
233 %
234 %
235 % \DescribeMacro{\Reflectbox}{<content>}
236 % This reflects the \meta{content} and is equal to \Macro\Scalebox{-1}{1}{<content>}.
237 %
238 %
239 % \DescribeMacro{\Resizebox}{<width>}{<height>}{<content>}
240 % Resizes the \meta{content} to the given \meta{width} and/or \meta{height}.
241 % The special value `|!|' can be used for one of the two values to scale it accordantly to the other value.
242 % \Macro\Resizebox{'!'}{'!'}{<content>} will not change the size of the content.
243 % If both values are used the aspect ratio might be changed. This can be avoided (for the local \TeX\ group) using
244 % \Macro\setkeys{Gin}{keepaspectratio}. Then the content is scaled to the smaller of the two values.
245 %
246 % \DescribeMacro{\Resizebox}'*'{<width>}{<totalheight>}{<content>}
247 % Like \Macro\Resizebox but scales the total height (= height + depth) instead of the height.
248 %
249 %
250 % \subsection{Macros of the \pkg{dashbox} package (option \opt{dashbox})}
251 %
252 % \DescribeMacro{\Dbox}{<content>}
253 % Like \Macro\Fbox but uses a dashed line instead.
254 %
255 % \DescribeMacro{\Dashbox}[<width>][<position>]{<content>}
256 % Like \Macro\Framebox but uses a dashed line instead.
257 %
258 % \DescribeMacro{\Lbox}[<layers>]{<content>}
259 % Draws some solid background layers to the lower right of the content which produces a shadow effect.
260 % The \meta{content} is supposed to also use \Macro\Dbox or \Macro\Fbox to draw the foreground dash or frame box.
261 % By default two layers are drawn but this can be changed by the optional argument.
262 %
263 % \DescribeMacro{\Dlbox}[<layers>]{<content>}
264 % Like \Macro\Lbox but draws the layers with dashed lines instead.
265 %
266 %
267 % \subsection{Compatibility with the \pkg{fancybox} package (option \opt{fancybox})}
268 % The \pkg{fancybox} package defines its macros already in a verbatim compatible way.
269 % However, if this option is used the \Macro\Sbox macro provided by the \opt{core} option is defined in a way to not
270 % collide with the \opt{Sbox} environment of this package.
271 %
272 % \StopEventually{}
273 %
274 % \clearpage
275 % \section{Implementation}
276 %
277 % \iffalse
278 %<*realboxes.sty>
279 % \fi
280 % \subsection{Package Header and Options}
281 % \begin{macrocode}
282 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
283 \ProvidesPackage{realboxes}[2011/08/08 v0.2 Change box commands to read there content as real boxes]
284 \newif\ifrealboxes@core
285 \newif\ifrealboxes@xcolor
286 \newif\ifrealboxes@color
287 \newif\ifrealboxes@graphicx
288 \newif\ifrealboxes@graphics
289 \newif\ifrealboxes@dashbox
290 \newif\ifrealboxes@fancybox
291 \DeclareOption{all}{%
292 \realboxes@coretrue
293 \realboxes@xcolortrue
294 \realboxes@colortrue
295 \realboxes@graphicxtrue
296 \realboxes@graphicstrue
297 \realboxes@dashboxtrue
298 \realboxes@fancyboxtrue
299 }
300 \DeclareOption*{%
301 \begingroup
302 \expandafter\ifx\csname realboxes@\CurrentOption true\endcsname\relax
303 \endgroup
304 \@unknownoptionerror
305 \else
306 \endgroup
307 \csname realboxes@\CurrentOption true\endcsname
308 \fi
309 }
310 \ProcessOptions\relax
311 % \end{macrocode}
312 %
313 % \begin{macrocode}
314 \edef\@tempa{\@ptionlist{\@currname.\@currext}}
315 \ifx\@tempa\empty
316 \realboxes@coretrue
317 \@ifpackageloaded{dashbox}{\realboxes@dashboxtrue}{}
318 \@ifpackageloaded{color}{\realboxes@colortrue}{}
319 \@ifpackageloaded{xcolor}{\realboxes@xcolortrue}{}
320 \@ifpackageloaded{graphics}{\realboxes@graphicstrue}{}
321 \@ifpackageloaded{graphicx}{\realboxes@graphicxtrue}{}
322 \@ifpackageloaded{fancybox}{\realboxes@fancyboxtrue}{}
323 \fi
324 % \end{macrocode}
325 %
326 % \begin{macrocode}
327 \ifrealboxes@fancybox
328 \realboxes@coretrue
329 \fi
330 % \end{macrocode}
331 %
332 % \begin{macrocode}
333 \RequirePackage{collectbox}
334 % \end{macrocode}
335 %
336 % \begin{macrocode}
337 \IfFileExists{adjcalc.sty}{%
338 \RequirePackage{adjcalc}
339 }{%
340 \RequirePackage{calc}
341 \def\adjsetlength{\setlength}
342 }
343 % \end{macrocode}
344 %
345 % \subsection{\LaTeX\ core}
346 % \begin{macrocode}
347 \ifrealboxes@core
348 % \end{macrocode}
349 %
350 % \begin{macro}{\Makebox}
351 % \begin{macrocode}
352 \newcommand*{\Makebox}{%
353 \collectboxcheckenv{Makebox}%
354 \@ifnextchar[%
355 \@Makebox
356 \mbox
357 }
358 % \end{macrocode}
359 % \end{macro}
360 %
361 %
362 % \begin{macro}{\@Makebox}
363 % \begin{macrocode}
364 \def\@Makebox[#1]{%
365 \@ifnextchar[%
366 {\@iMakebox{#1}}%
367 {\@iMakebox{#1}[c]}%
368 }
369 % \end{macrocode}
370 % \end{macro}
371 %
372 %
373 % \begin{macro}{\@iMakebox}
374 % \begin{macrocode}
375 \def\@iMakebox#1[#2]{%
376 \@collectbox{%
377 \let\@tempboxa\collectedbox
378 \adjsetlength\@tempdima{#1}%
379 \hb@xt@\@tempdima{\csname bm@#2\endcsname}%
380 }%
381 }
382 % \end{macrocode}
383 % \end{macro}
384 %
385 %
386 % \begin{macro}{\Fbox}
387 % \begin{macrocode}
388 \newcommand*\Fbox{%
389 \collectbox@{\kern\fboxsep}{\let\@tempboxa\collectedbox\@frameb@x\relax}{\kern\fboxsep}%
390 }
391 % \end{macrocode}
392 % \end{macro}
393 %
394 %
395 % \begin{macro}{\Frame}
396 % \begin{macrocode}
397 \newcommand*\Frame{%
398 \@collectbox{\frame\BOXCONTENT}%
399 }
400 % \end{macrocode}
401 % \end{macro}
402 %
403 %
404 % \begin{macro}{\Mbox}
405 % \begin{macrocode}
406 \newcommand*\Mbox{%
407 \leavevmode
408 \@ifnextchar\bgroup
409 \hbox
410 \mbox
411 }
412 % \end{macrocode}
413 % \end{macro}
414 %
415 %
416 % \begin{macro}{\Raisebox}
417 % \begin{macrocode}
418 \newcommand*\Raisebox[1]{%
419 \leavevmode
420 \collectboxcheckenv{Raisebox}%
421 \@ifnextchar[%
422 {\@Rsbox{#1}}%
423 {\@collectbox{\@iRsbox{#1}{}}}%
424 }
425 % \end{macrocode}
426 % \end{macro}
427 %
428 %
429 % \begin{macro}{\@Rsbox}
430 % \begin{macrocode}
431 \def\@Rsbox#1[#2]{%
432 \@ifnextchar[%
433 {\@iiRsbox{#1}{#2}}%
434 {\@collectbox{\@iRsbox{#1}{#2}}}%
435 }
436 % \end{macrocode}
437 % \end{macro}
438 %
439 %
440 % \begin{macro}{\@iRsbox}
441 % \begin{macrocode}
442 \def\@iRsbox#1#2{%
443 \adjsetlength\@tempdima{#1}%
444 \ifx \\#2\\\else
445 \adjsetlength\@tempdimb{#2}%
446 \fi
447 \setbox\collectedbox\hbox{\raise\@tempdima\box\collectedbox}%
448 \ifx \\#2\\\else
449 \ht\collectedbox\@tempdimb
450 \fi
451 \box\collectedbox
452 }
453 % \end{macrocode}
454 % \end{macro}
455 %
456 %
457 % \begin{macro}{\@iiRsbox}
458 % \begin{macrocode}
459 \def\@iiRsbox#1#2[#3]{%
460 \@collectbox{\@iiiRsbox{#1}{#2}{#3}}%
461 }
462 % \end{macrocode}
463 % \end{macro}
464 %
465 %
466 % \begin{macro}{\@iiiRsbox}
467 % \begin{macrocode}
468 \def\@iiiRsbox#1#2#3{%
469 \adjsetlength\@tempdima{#1}%
470 \adjsetlength\@tempdimb{#2}%
471 \adjsetlength\dimen@{#3}%
472 \setbox\collectedbox\hbox{\raise\@tempdima\box\collectedbox}%
473 \ht\collectedbox\@tempdimb
474 \dp\collectedbox\dimen@
475 \box\collectedbox
476 }
477 % \end{macrocode}
478 % \end{macro}
479 %
480 %
481 % \begin{macro}{\Leftline}
482 % \begin{macrocode}
483 \newcommand*\Leftline{\nocollectbox@to\linewidth{}{}\hss}
484 % \end{macrocode}
485 % \end{macro}
486 %
487 %
488 % \begin{macro}{\Rightline}
489 % \begin{macrocode}
490 \newcommand*\Rightline{\nocollectbox@to\linewidth\hss{}{}}
491 % \end{macrocode}
492 % \end{macro}
493 %
494 %
495 % \begin{macro}{\Centerline}
496 % \begin{macrocode}
497 \newcommand*\Centerline{\nocollectbox@to\linewidth\hss{}\hss}
498 % \end{macrocode}
499 % \end{macro}
500 %
501 %
502 % \begin{macro}{\Rlap}
503 % \begin{macrocode}
504 \newcommand*\Rlap{\nocollectbox@to\z@{}{}\hss}
505 % \end{macrocode}
506 % \end{macro}
507 %
508 %
509 % \begin{macro}{\Llap}
510 % \begin{macrocode}
511 \newcommand*\Llap{\nocollectbox@to\z@\hss{}{}}
512 % \end{macrocode}
513 % \end{macro}
514 %
515 %
516 % \begin{macro}{\Framebox}
517 % \begin{macrocode}
518 \newcommand*\Framebox{%
519 \collectboxcheckenv{Framebox}%
520 \@ifnextchar[%
521 \@Framebox
522 \Fbox
523 }
524 % \end{macrocode}
525 % \end{macro}
526 %
527 %
528 % \begin{macro}{\@Framebox}
529 % \begin{macrocode}
530 \def\@Framebox[#1]{%
531 \@ifnextchar[%
532 {\@iFramebox{#1}}%
533 {\@iFramebox{#1}[c]}%
534 }
535 % \end{macrocode}
536 % \end{macro}
537 %
538 %
539 % \begin{macro}{\@iFramebox}
540 % \begin{macrocode}
541 \def\@iFramebox#1[#2]{%
542 \@collectbox{\@iiFramebox{#1}{#2}}%
543 }
544 % \end{macrocode}
545 % \end{macro}
546 %
547 %
548 % \begin{macro}{\@iiFramebox}
549 % \begin{macrocode}
550 \def\@iiFramebox#1#2{%
551 \let\@tempboxa\collectedbox
552 \adjsetlength\@tempdima{#1}%
553 \setbox\@tempboxa\hb@xt@\@tempdima
554 {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
555 \@frameb@x{\kern-\fboxrule}%
556 }
557 % \end{macrocode}
558 % \end{macro}
559 %
560 %
561 % \begin{macro}{\Parbox}
562 % \begin{macrocode}
563 \newcommand\Parbox{%
564 \collectboxcheckenv{Parbox}%
565 \@ifnextchar[%
566 \@iParbox
567 {\@iiiParbox c\relax[s]}%
568 }
569 % \end{macrocode}
570 % \end{macro}
571 %
572 %
573 % \begin{macro}{\@iParbox}
574 % \begin{macrocode}
575 \def\@iParbox[#1]{%
576 \@ifnextchar[%
577 {\@iiParbox{#1}}%
578 {\@iiiParbox{#1}\relax[s]}%
579 }
580 % \end{macrocode}
581 % \end{macro}
582 %
583 %
584 % \begin{macro}{\@iiParbox}
585 % \begin{macrocode}
586 \def\@iiParbox#1[#2]{%
587 \@ifnextchar[%
588 {\@iiiParbox{#1}{#2}}%
589 {\@iiiParbox{#1}{#2}[#1]}%
590 }
591 % \end{macrocode}
592 % \end{macro}
593 %
594 %
595 % \begin{macro}{\@iiiParbox}
596 % \begin{macrocode}
597 \def\@iiiParbox#1#2[#3]#4{%
598 \leavevmode
599 \begingroup
600 \@pboxswfalse
601 \adjsetlength\@tempdima{#4}%
602 \let\collect@box\vbox
603 \let\@tempboxa\collectedbox
604 \collectbox@{\hsize\@tempdima\@parboxrestore}{\@vParbox{#1}{#2}{#3}}{\@@par}%
605 }
606 % \end{macrocode}
607 % \end{macro}
608 %
609 %
610 % \begin{macro}{\@vParbox}
611 % \begin{macrocode}
612 \def\@vParbox#1#2#3{%
613 \ifx\relax#2\else
614 \adjsetlength\@tempdimb{#2}%
615 \edef\@parboxto{to\the\@tempdimb}%
616 \fi
617 \if#1b\vbox
618 %\else\if #1B\vbox
619 \else\if #1t\vtop
620 %\else\if #1T\vtop
621 \else\ifmmode\vcenter
622 \else\@pboxswtrue $\vcenter
623 \fi\fi\fi
624 %\fi\fi
625 \@parboxto{\let\hss\vss\let\unhbox\unvbox
626 \csname bm@#3\endcsname}%
627 \if@pboxsw \m@th$\fi
628 \endgroup
629 }
630 % \end{macrocode}
631 % \end{macro}
632 %
633 %
634 % \begin{macro}{\Sbox@}
635 % \begin{macrocode}
636 \newcommand*\Sbox@[1]{\@collectboxto{#1}{}}
637 % \end{macrocode}
638 % \end{macro}
639 %
640 %
641 % \begin{macro}{\Savebox}
642 % \begin{macrocode}
643 \def\Savebox#1{%
644 \@ifnextchar[%
645 {\@Savebox#1}%
646 {\Sbox@#1}%
647 }
648 % \end{macrocode}
649 % \end{macro}
650 %
651 % \subsubsection{\pkg{fancybox} Compatibility}
652 %
653 % \begin{macrocode}
654 \ifrealboxes@fancybox
655 \RequirePackage{fancybox}
656 \let\orig@fancy@Sbox\Sbox
657 % \end{macrocode}
658 %
659 % \begin{macro}{\Sbox}
660 % \begin{macrocode}
661 \def\Sbox{%
662 \begingroup
663 \def\@tempa{Sbox}%
664 \expandafter\endgroup
665 \ifx\@currenvir\@tempa
666 \orig@fancy@Sbox
667 \edef\@currenvir{\@currenvir\space}%
668 \else
669 \expandafter\Sbox@
670 \fi
671 }
672 % \end{macrocode}
673 % \end{macro}
674 %
675 % \begin{macrocode}
676 \else
677 \let\Sbox\Sbox@
678 \AtBeginDocument{\@ifpackageloaded{fancybox}{%
679 \PackageWarning{realboxes}{Package 'fancybox' got loaded. This requires 'realboxes' to be loaded with the 'fancybox' option!}%
680 }{}}%
681 \fi
682 % \end{macrocode}
683 %
684 % \begin{macro}{\@Savebox}
685 % \begin{macrocode}
686 \def\@Savebox#1[#2]{%
687 \@ifnextchar [%
688 {\@iSavebox#1{#2}}%
689 {\@iSavebox#1{#2}[c]}%
690 }
691 % \end{macrocode}
692 % \end{macro}
693 %
694 %
695 % \begin{macro}{\@iSavebox}
696 % \begin{macrocode}
697 \def\@iSavebox#1#2[#3]{%
698 \@collectboxto#1{\@iiSavebox{#1}{#2}{#3}}%
699 }
700 % \end{macrocode}
701 % \end{macro}
702 %
703 %
704 % \begin{macro}{\@iiSavebox}
705 % \begin{macrocode}
706 \def\@iiSavebox#1#2#3{%
707 \sbox#1{%
708 \let\@tempboxa#1%
709 \adjsetlength\@tempdima{#2}%
710 \hb@xt@\@tempdima{\csname bm@#3\endcsname}%
711 }%
712 }
713 % \end{macrocode}
714 % \end{macro}
715 %
716 % \begin{macrocode}
717 \fi
718 % \end{macrocode}
719 %
720 % \subsection{\pkg{color} and \pkg{xcolor} Packages}
721 % \begin{macrocode}
722 \ifrealboxes@xcolor
723 \RequirePackage{xcolor}
724 \realboxes@colortrue
725 \else
726 \ifrealboxes@color
727 \RequirePackage{color}
728 \fi
729 \fi
730 \ifrealboxes@color
731 % \end{macrocode}
732 %
733 % \begin{macro}{\Colorbox}
734 % \begin{macrocode}
735 \newcommand*\Colorbox{}%
736 % \end{macrocode}
737 % \end{macro}
738 %
739 %
740 % \begin{macro}{\Colorbox}
741 % \begin{macrocode}
742 \def\Colorbox#1#{%
743 \collectboxcheckenv{Colorbox}%
744 \Color@box{#1}%
745 }
746 % \end{macrocode}
747 % \end{macro}
748 %
749 %
750 % \begin{macro}{\Color@box}
751 % \begin{macrocode}
752 \def\Color@box#1#2{%
753 \@collectbox{\color@box{#1}{#2}\BOXCONTENT}%
754 }
755 % \end{macrocode}
756 % \end{macro}
757 %
758 %
759 % \begin{macro}{\Fcolorbox}
760 % \begin{macrocode}
761 \newcommand*\Fcolorbox{}
762 % \end{macrocode}
763 % \end{macro}
764 %
765 %
766 % \begin{macro}{\Fcolorbox}
767 % \begin{macrocode}
768 \def\Fcolorbox#1#{%
769 \collectboxcheckenv{Fcolorbox}%
770 \Color@fbox{#1}%
771 }
772 % \end{macrocode}
773 % \end{macro}
774 %
775 %
776 % \begin{macro}{\Color@fbox}
777 % \begin{macrocode}
778 \def\Color@fbox#1#2#3#{%
779 \Color@@fbox{#1}{#2}{#3}%
780 }
781 % \end{macrocode}
782 % \end{macro}
783 %
784 %
785 % \begin{macro}{\Color@@fbox}
786 % \begin{macrocode}
787 \def\Color@@fbox#1#2#3#4{%
788 \protect\@collectbox{\protect\color@fb@x{#1}{#2}{#3}{#4}\BOXCONTENT}%
789 }
790 % \end{macrocode}
791 % \end{macro}
792 %
793 % \begin{macrocode}
794 \fi
795 % \end{macrocode}
796 %
797 % \subsection{\pkg{color} and \pkg{xcolor} Packages}
798 % \begin{macrocode}
799 \ifrealboxes@graphicx
800 \RequirePackage{graphicx}
801 \realboxes@graphicstrue
802 \else
803 \ifrealboxes@graphics
804 \RequirePackage{graphics}
805 \fi
806 \fi
807 \ifrealboxes@graphics
808 % \end{macrocode}
809 %
810 % \begin{macro}{\Rotatebox}
811 % \begin{macrocode}
812 \newcommand*\Rotatebox{%
813 \collectboxcheckenv{Rotatebox}%
814 \@ifnextchar[%
815 \Rotatebox@kv
816 \Rotatebox@std
817 }
818 % \end{macrocode}
819 % \end{macro}
820 %
821 %
822 % \begin{macro}{\Rotatebox@kv}
823 % \begin{macrocode}
824 \def\Rotatebox@kv[#1]#2{%
825 \@collectbox{\Grot@box@kv[#1]{#2}\BOXCONTENT}%
826 }
827 % \end{macrocode}
828 % \end{macro}
829 %
830 %
831 % \begin{macro}{\Rotatebox@std}
832 % \begin{macrocode}
833 \def\Rotatebox@std#1{%
834 \@collectbox{\Grot@box@std{#1}\BOXCONTENT}%
835 }
836 % \end{macrocode}
837 % \end{macro}
838 %
839 %
840 % \begin{macro}{\Scalebox}
841 % \begin{macrocode}
842 \newcommand*\Scalebox[1]{%
843 \collectboxcheckenv{Scalebox}%
844 \@ifnextchar[%
845 {\Scale@box{#1}}%
846 {\Scale@box{#1}[#1]}%
847 }
848 % \end{macrocode}
849 % \end{macro}
850 %
851 %
852 % \begin{macro}{\Scale@box}
853 % \begin{macrocode}
854 \def\Scale@box#1[#2]{%
855 \@collectbox{\Gscale@box{#1}[#2]\BOXCONTENT}%
856 }
857 % \end{macrocode}
858 % \end{macro}
859 %
860 %
861 % \begin{macro}{\Reflectbox}
862 % \begin{macrocode}
863 \newcommand*\Reflectbox{%
864 \collectboxcheckenv{Reflectbox}%
865 \Scale@box{-1}[1]%
866 }
867 % \end{macrocode}
868 % \end{macro}
869 %
870 %
871 % \begin{macro}{\Resizebox}
872 % \begin{macrocode}
873 \newcommand*\Resizebox{%
874 \collectboxcheckenv{Resizebox}%
875 \@ifstar
876 {\@Resizebox\totalheight}%
877 {\@Resizebox\height}%
878 }
879 % \end{macrocode}
880 % \end{macro}
881 %
882 %
883 % \begin{macro}{\Resizebox}
884 % \begin{macrocode}
885 \@namedef{Resizebox*}{%
886 \@collectboxisenv{Resizebox*}%
887 \@Resizebox\totalheight
888 }
889 % \end{macrocode}
890 % \end{macro}
891 %
892 % \begin{macro}{\@Resizebox}
893 % \begin{macrocode}
894 \def\@Resizebox#1#2#3{%
895 \@collectbox{\let\setlength\adjsetlength\Gscale@@box{#1}{#2}{#3}\BOXCONTENT}%
896 }
897 % \end{macrocode}
898 % \end{macro}
899 %
900 % \begin{macrocode}
901 \fi
902 % \end{macrocode}
903 %
904 %
905 % \subsection{\pkg{dashbox} Package}
906 % \begin{macrocode}
907 \ifrealboxes@dashbox
908 \RequirePackage{dashbox}
909 % \end{macrocode}
910 %
911 % \begin{macro}{\Dbox}
912 % \begin{macrocode}
913 \newcommand*\Dbox{%
914 \@collectbox{\dbox{\BOXCONTENT}}%
915 }
916 % \end{macrocode}
917 % \end{macro}
918 %
919 %
920 % \begin{macro}{\Dashbox}
921 % \begin{macrocode}
922 \newcommand*\Dashbox{%
923 \@ifnextchar[%
924 \@Dashbox
925 \Dbox
926 }
927 % \end{macrocode}
928 % \end{macro}
929 %
930 %
931 % \begin{macro}{\@Dashbox}
932 % \begin{macrocode}
933 \def\@Dashbox[#1]{%
934 \@ifnextchar[%
935 {\@iDashbox{#1}}%
936 {\@iDashbox{#1}[c]}%
937 }
938 % \end{macrocode}
939 % \end{macro}
940 %
941 %
942 % \begin{macro}{\@iDashbox}
943 % \begin{macrocode}
944 \def\@iDashbox#1[#2]{%
945 \@collectbox{\dashbox[#1][#2]{\BOXCONTENT}}%
946 }
947 % \end{macrocode}
948 % \end{macro}
949 %
950 %
951 % \begin{macro}{\Lbox}
952 % \begin{macrocode}
953 \newcommand*\Lbox{%
954 \@ifnextchar[%
955 \@Lbox
956 {\@collectbox{\lbox{\BOXCONTENT}}}%
957 }
958 % \end{macrocode}
959 % \end{macro}
960 %
961 %
962 % \begin{macro}{\@Lbox}
963 % \begin{macrocode}
964 \def\@Lbox[#1]{%
965 \@collectbox{\lbox[#1]{\BOXCONTENT}}%
966 }
967 % \end{macrocode}
968 % \end{macro}
969 %
970 %
971 % \begin{macro}{\Dlbox}
972 % \begin{macrocode}
973 \newcommand*\Dlbox{%
974 \@ifnextchar[%
975 \@Dlbox
976 {\@collectbox*\dlbox}%
977 }
978 % \end{macrocode}
979 % \end{macro}
980 %
981 %
982 % \begin{macro}{\@Dlbox}
983 % \begin{macrocode}
984 \def\@Dlbox[#1]{%
985 \@collectbox{\dlbox[#1]{\BOXCONTENT}}%
986 }
987 % \end{macrocode}
988 % \end{macro}
989 %
990 % \begin{macrocode}
991 \fi
992 % \end{macrocode}
993 %
994 %
995 % \iffalse
996 %</realboxes.sty>
997 % \fi
998 %
999 % \Finale
1000 \endinput