calc: Vertical Compositions
7.8.10.3 Vertical Compositions
..............................
The ‘cvert’ function makes a vertical composition. Each component of
the vector is centered in a column. The baseline of the result is by
default the top line of the resulting composition. For example,
‘f(cvert([a, bb, ccc]), cvert([a^2 + 1, b^2]))’ formats in Big mode as
f( a , 2 )
bb a + 1
ccc 2
b
There are several special composition functions that work only as
components of a vertical composition. The ‘cbase’ function controls the
baseline of the vertical composition; the baseline will be the same as
the baseline of whatever component is enclosed in ‘cbase’. Thus
‘f(cvert([a, cbase(bb), ccc]), cvert([a^2 + 1, cbase(b^2)]))’ displays
as
2
a + 1
a 2
f(bb , b )
ccc
There are also ‘ctbase’ and ‘cbbase’ functions which make the
baseline of the vertical composition equal to the top or bottom line
(rather than the baseline) of that component. Thus ‘cvert([cbase(a /
b)]) + cvert([ctbase(a / b)]) + cvert([cbbase(a / b)])’ gives
a
a -
- + a + b
b -
b
There should be only one ‘cbase’, ‘ctbase’, or ‘cbbase’ function in a
given vertical composition. These functions can also be written with no
arguments: ‘ctbase()’ is a zero-height object which means the baseline
is the top line of the following item, and ‘cbbase()’ means the baseline
is the bottom line of the preceding item.
The ‘crule’ function builds a “rule,” or horizontal line, across a
vertical composition. By itself ‘crule()’ uses ‘-’ characters to build
the rule. You can specify any other character, e.g., ‘crule("=")’. The
argument must be a character code or vector of exactly one character
code. It is repeated to match the width of the widest item in the
stack. For example, a quotient with a thick line is ‘cvert([a + 1,
cbase(crule("=")), b^2])’:
a + 1
=====
2
b
Finally, the functions ‘clvert’ and ‘crvert’ act exactly like ‘cvert’
except that the items are left- or right-justified in the stack. Thus
‘clvert([a, bb, ccc]) + crvert([a, bb, ccc])’ gives:
a + a
bb bb
ccc ccc
Like ‘choriz’, the vertical compositions accept a second argument
which gives the precedence to use when formatting the components.
Vertical compositions do not support separator strings.