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
|
% oubraces.sty: Interleave \overbrace with \underbrace
%
% \overunderbraces{upper_braces}{main_formula}{lower_braces}
%
% Instructions are given below, after \endinput, and in oubraces.tex (.pdf)
%
% Copyright 1993,2011 Donald Arseneau, Vancouver, Canada
%
% Redistribution and use, with or without modification, are permitted provided
% that the above copyright notice and this condition for use are retained.
\begingroup
\catcode`\@=\catcode`A
\gdef\overunderbraces #1#2#3{{%
\baselineskip\z@skip \lineskip4\p@ \lineskiplimit4\p@
\displaystyle % deliberately generate error if not in math mode!
% first, do the top half of the alignment in a save-box ...
\setbox\z@\vbox{\ialign{&\hfil${}##{}$\hfil\cr
\global\let\br\br@label #1\cr % upper labels
\global\let\br\br@down #1\cr % upper braces
#2\cr % main line of the formula
}}% finished partial alignment and \vbox.
\dimen@-\ht\z@ % Measure height of partial alignment --
% ... it is the height we want for the whole.
% Now do the whole alignment (notice the repetition from above)
\setbox\z@\vbox{\ialign{&\hfil${}##{}$\hfil\cr
\global\let\br\br@label #1\cr % upper labels
\global\let\br\br@down #1\cr % upper braces
#2\cr % main line of the formula
\global\let\br\br@up #3\cr % lower braces
% \noalign{\kern2\p@}% % because
\global\let\br\br@label #3\cr % lower labels
}}% finished whole alignment and \vbox.
\advance\dimen@\ht\z@ % calc. the necessary lowering
\lower\dimen@\hbox{\box\z@}% shift to get the desired height
}}
% Three aliases for \br.
% #1=number of spanned columns, #2=label
\gdef\br@up#1#2{\multispan{#1}\upbracefill}
\gdef\br@down#1#2{\multispan{#1}\downbracefill}
\gdef\br@label#1#2{\multispan{#1}\hidewidth $\scriptstyle {#2}$\hidewidth}
\endgroup
\endinput
%
%-----------------------------------------------------------------
%
% oubraces.sty: Interleave \overbrace with \underbrace
% Donald Arseneau, 1993
%
% The syntax is:
%
% \overunderbraces{upper_braces}{main_formula}{lower_braces}
%
% Suppose we want the equation:
% x y
% ,-----^-----. ,-----^-----.
% a + b + c + d + e + f + g + h + i + j + k + l + m = \pi r^2
% `-----v-----'
% z
% There are seven segments:
% x y
% ,-----^-----. ,-----^-----.
% a + b + c + d + e + f + g + h + i + j + k + l + m = \pi r^2
% 11111111222222223333344455555666666667777777777...
% `-----v-----'
% z
% Insert & between each segment (where the tips of the braces point)
% to type the main_formula:
% x y
% ,-----^-----. ,-----^-----.
% a + b +&c + d +&e + f&+&g + h&+ i + j&+ k + l + m
% `-----v-----'
% z
% Each brace should be specified by typing
%
% \br{number_of_segments}{label},
%
% separated by & to indicate which segment to start at; and
% where & & skips a segment that has no brace. For our
% example formula, the upper and lower brace specifiers are:
%
% top row: &\br{2}{x}& &\br{2}{y}
% bot row: & &\br{3}{z}
%
% Now put them all together:
%
% \overunderbraces{&\br{2}{x}& &\br{2}{y}}%
% {a + b +&c + d +&e + f&+&g + h&+ i + j&+ k + l + m}%
% {& &\br{3}{z}}
% = \pi r^2
|