summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/realboxes/realboxes.dtx
blob: 3ba41edd049f1b7d41f740ec7a7dda2c6601fd07 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \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