summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/epslatex-fr/boxes.sty
blob: 75b659ba25c10ca8bd2e90a7d46651d18d3c3dff (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
\ifx\@boxes@loaded\undefined
\newdimen\YdimenA
\newdimen\YdimenB
\newbox\YboxA
% ======================================================================
% ======================== BOITES ======================================
% ======================================================================

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \borderandboxit
%   the first parameter is a dimension giving a border width,
% the second is the rule width for the box,
% and the third is a box of text.
% \borderandboxit takes its third parameter and surrounds it with 
% a border of space on all sides then with rules.
% The second parameter gives the thickness of the rules to use.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\borderandboxit#1#2#3{\vbox{\hrule \@height#2%
  \hbox{\vrule \@width#2 \hskip#1 \hskip-#2%
  \vbox{\vskip#1\relax#3\vskip#1}\hskip#1\hskip-#2%
        \vrule \@width#2}\hrule \@height#2}}
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%
% \boxrulethickness  is a new dimension that gives the thickness
%   of the rules to be used for the boxes defined by the current
% family of ruled boxes.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%
\newdimen\boxrulethickness \boxrulethickness=.4pt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \Square
%   the parameter is a dimension.
% An empty square ruled box (with rules of the \boxrulethickness),
% the length of whose side is the given dimension, is set with
% the bottom side on the current baseline.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\Square#1{\leavevmode\borderandboxit{\z@}%
  \boxrulethickness{\hbox to #1{\vbox to #1{\vss}\hss}}}
\def\@carr#1#2{{\vcenter{\vbox{\hrule height.#2pt
        \hbox{\vrule width.#2pt height#1pt \kern#1pt
           \vrule width.#2pt}
        \hrule height.#2pt}}}}
\def\carre{\mathchoice\@carr34\@carr34\@carr{2.1}3\@carr{1.5}3}

 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \boxit
%   the parameter is a box of text.
% \boxit takes its parameter and surrounds it with approximately
% \fboxsep of space on all sides then with rules.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\boxit#1{\borderandboxit{\fboxsep}\boxrulethickness{#1}}
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \boxaround
%   the parameter is text (including possibly several paragraphs).
% \boxaround allows its parameter to be several paragraphs;
% it does some vertical spacing, then forms a box to the columnwidth
% around the text.  The left and right margin around the text 
% inside the box is \boxaroundhmargin; \boxaroundvmargin gives
% the upper and lower margin.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newdimen\boxaroundhmargin \newdimen\boxaroundvmargin
\boxaroundhmargin=3pt        % by default, this isn't much
\boxaroundvmargin=3pt        % by default, this isn't much
 
\long\def\boxaround#1{\vskip6pt
% {\YdimenA=\hsize \advance\YdimenA by-\boxaroundhmargin
  {\YdimenA=\columnwidth \advance\YdimenA by-\boxaroundhmargin
   \advance\YdimenA by-\boxaroundhmargin   % once for each side
%  \setbox\YboxA=\hbox to \hsize{\hss
   \setbox\YboxA=\hbox to \columnwidth{\hss
%                    \vbox{\hsize=\YdimenA
                     \vbox{\columnwidth=\YdimenA
                           \vskip\boxaroundvmargin #1
                           \vskip\boxaroundvmargin}\hss}%
   \borderandboxit{\z@}\boxrulethickness{\box\YboxA}}%
  \vskip2pt plus\z@ minus\z@}
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \reservedbox
%   parameters are two dimensions which give the width and
% height respectively of a reserved box.
%   This macro inserts a ruled vbox of the given dimensions.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\reservedbox#1#2{\par
 {\YdimenA=#1 \YdimenB=#2
  \setbox\YboxA=\hbox to \YdimenA{\hss\vrule height \YdimenB width \z@}%
  \vbox to #2{\vss\hbox{\hss\borderandboxit{\z@}%
              \boxrulethickness{\box\YboxA}\hss}\vss}%
 }                   % extra level to localize change of dimens 
}
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \reservedcolbox
%   the parameter gives a dimension.
% forms a \reservedbox with a width of \the\columnwidth and a
% height determined by the parameter.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\def\reservedcolbox#1{\reservedbox{\hsize}{#1}}
\def\reservedcolbox#1{\reservedbox{\columnwidth}{#1}}
\let\@boxes@loaded=\reservedcolbox
\else
\typeout{boxes.sty already loaded}
\fi