calc: Other Compositions
7.8.10.4 Other Compositions
...........................
The ‘csup’ function builds a superscripted expression. For example,
‘csup(a, b)’ looks the same as ‘a^b’ does in Big language mode. This is
essentially a horizontal composition of ‘a’ and ‘b’, where ‘b’ is
shifted up so that its bottom line is one above the baseline.
Likewise, the ‘csub’ function builds a subscripted expression. This
shifts ‘b’ down so that its top line is one below the bottom line of ‘a’
(note that this is not quite analogous to ‘csup’). Other arrangements
can be obtained by using ‘choriz’ and ‘cvert’ directly.
The ‘cflat’ function formats its argument in “flat” mode, as obtained
by ‘d O’, if the current language mode is normal or Big. It has no
effect in other language modes. For example, ‘a^(b/c)’ is formatted by
Big mode like ‘csup(a, cflat(b/c))’ to improve its readability.
The ‘cspace’ function creates horizontal space. For example,
‘cspace(4)’ is effectively the same as ‘string(" ")’. A second string
(i.e., vector of characters) argument is repeated instead of the space
character. For example, ‘cspace(4, "ab")’ looks like ‘abababab’. If
the second argument is not a string, it is formatted in the normal way
and then several copies of that are composed together: ‘cspace(4, a^2)’
yields
2 2 2 2
a a a a
If the number argument is zero, this is a zero-width object.
The ‘cvspace’ function creates vertical space, or a vertical stack of
copies of a certain string or formatted object. The baseline is the
center line of the resulting stack. A numerical argument of zero will
produce an object which contributes zero height if used in a vertical
composition.
There are also ‘ctspace’ and ‘cbspace’ functions which create
vertical space with the baseline the same as the baseline of the top or
bottom copy, respectively, of the second argument. Thus ‘cvspace(2,
a/b) + ctspace(2, a/b) + cbspace(2, a/b)’ displays as:
a
-
a b
- a a
b + - + -
a b b
- a
b -
b