@Section
   @Title { Symbols }
   @Tag { symbols }
@Begin
@PP
@Code "@Eq" prints characters in the fonts appropriate for mathematics:
@ID {
@Code "x - 2"
|7ct
@Eq { x-2 }
}
Here @Eq { x } is in Italic, @Eq { 2 } is in Roman, and @Eq { minus } is
from the Symbol font.  The character @Code "-" is a @I symbol which
stands for @Eq {minus}, and @Code "2" is also a symbol, standing for
@Eq { 2 }.  @Code "@Eq" includes a vast number of symbols:
@ID {
@Code "Omega delta int partial club"
|7ct
@Eq { Omega delta int partial club }
}
The summary at the end of this chapter has the complete list.
@PP
Symbols whose names are made from letters should be separated from each
other by at least one space or end of line, as was done above, or else
@Code "@Eq" will become confused:
@ID {
@Code "Omegadelta"
|7ct
@Eq { Omegadelta }
}
Symbols whose names are made from digits and punctuation characters can,
however, be run together with each other and with symbols made from
letters:
@ID {
@Code "Omega-delta<=2"
|7ct
@Eq { Omega-delta<=2 }
}
This rule applies throughout Lout (Section {@NumberOf spaces}).
@PP
Some symbols join objects together in mathematical ways:
@ID {
@Code "x sub 2"
|7ct
@Eq { x sub 2 }
}
Here the @Code "sub" symbol has taken the object just to its left, and
equations. @RawIndex { equations }
equations.sub @SubIndex { @Code "sub" symbol }
sub.sym.equations @Index { @Code "sub" symbol (equations) }
the object just to its right, and joined them into one object in the
form of a subscript.  The two objects are called the left and right
parameters of {@Code "sub"}, and they may be arbitrary Lout objects.
@PP
Other symbols of a similar kind include {@Code "sup"} for
equations. @RawIndex { equations }
equations.sup @SubIndex { @Code "sup" symbol }
sup.equations @Index { @Code "sup" symbol (equations) }
superscripting, @Code "over" for built-up fractions, and @Code "from"
equations. @RawIndex { equations }
equations.over @SubIndex { @Code "over" symbol }
over.equations @Index { @Code "over" symbol (equations) }
equations. @RawIndex { equations }
equations.from @SubIndex { @Code "from" symbol }
from.equations @Index { @Code "from" symbol (equations) }
equations. @RawIndex { equations }
equations.to @SubIndex { @Code "to" symbol }
to.equations @Index { @Code "to" symbol (equations) }
and @Code "to" for the lower and upper limits of sums, products,
etc.  These symbols may be used together to produce complicated
equations very easily:
@ID {
@Code {
"big sum from i=0 to n r sup i"
"= {r sup n+1 - 1} over r-1"
}
||7ct
@Eq { big sum from i=0 to n r sup i
= {r sup n+1 - 1} over r-1
}
}
Here @Code "sum" is just the @Eq { summation } symbol; @Code "from" and
@Code "to" do all the work of placing the limits.  They are quite
independent, so either or both may be omitted.  To get a superscript
directly over a subscript, use the @Code "supp" and @Code "on" symbols:
equations. @RawIndex { equations }
equations.supp @SubIndex { @Code "supp" symbol }
supp.equations @Index { @Code "supp" symbol (equations) }
equations. @RawIndex { equations }
equations.on @SubIndex { @Code "on" symbol }
on.equations @Index { @Code "on" symbol (equations) }
@ID {
@Code "A supp b on a"
|7ct
@Eq { A supp b on a }
}
These two symbols should always be used together as shown.
@PP
Sometimes a subscript appears to be too far to the right, owing to
the slope of italic letters: in @Eq { W sub n }, for example.  You
can fix this by using `tucked' subscripts, like this:
@IndentedList
@LI {
@Code "W tsub n"
|7ct
@Eq { W tsub n }
}
@LI {
@Code "W supp b ton a"
|7ct
@Eq { W supp b ton a }
}
@EndList
The @Code "tsub" and @Code "ton" symbols are exactly like @Code "sub"
equations. @RawIndex { equations }
equations.tsub @SubIndex { @Code "tsub" symbol }
tsub.equations @Index { @Code "tsub" symbol (equations) }
equations. @RawIndex { equations }
equations.ton @SubIndex { @Code "ton" symbol }
ton.equations @Index { @Code "ton" symbol (equations) }
and @Code "on" except for this tucking-in effect.  However, the
@Code "sub" symbol itself does a certain amount of tucking in; the
amount is determined by kerning information in the font files and
so is sensitive to the shape of the letters.
@PP
As usual in Lout, braces are used to group something into an indivisible
object.  Leaving them out creates ambiguities:
@ID @Code "a  sup  b  over  c"
There are two possible interpretations for this:
@IndentedList
@LI {
@Code "{a  sup  b}  over  c"
|7ct
@Eq {  {a  sup  b}  over  c }
}
@LI {
@Code "a  sup  {b  over  c}"
|7ct
@Eq {  a  sup  {b  over  c} }
}
@EndList
@Code "@Eq" chooses between them in the following way.  Every symbol that
takes a parameter also has a {@I precedence}, which is a number.  For
equations. @RawIndex { equations }
equations.precedence @SubIndex { precedence of symbols }
precedence.equations @Index { precedence of symbols in equations }
example, @Code "sup" has precedence 60 and @Code "over" has precedence
54.  The symbol with the highest precedence wins the object lying between
them, so in the above case the first interpretation is chosen.  If two
symbols of equal precedence compete for an object, the association is
towards the left:
@ID {
@Code "a sup b sub 2"
|7ct
@Eq { a sup b sub 2 }
}
In this case it is more probable that the following right association
was actually wanted:
@ID {
@Code "a sup { b sub 2 }"
|7ct
@Eq { a sup { b sub 2 } }
}
When in doubt, use braces to make the grouping clear.
@PP
White space between two objects is considered to be a symbol with
precedence 7, which is lower than the precedence of any @Code "@Eq"
symbol; but if the two objects are immediately adjacent and neither is
enclosed in braces the precedence is 102, which is higher than the
precedence of any @Code "@Eq" symbol.  Compare these three examples:
@IL
@LI {
@Code "big sum from i=0 to n"
|7ct
@Eq {  big sum from i=0 to n }
}
@LI {
@Code "big sum from {i = 0} to n"
|7ct
@Eq {  big sum from {i = 0} to n }
}
@LI {
@Code "big sum from i = 0 to n"
|7ct
@Eq {  big sum from i = 0 to n }
}
@EL
and you will see that some care is needed on this point.  Braces can
always be used to override precedence and associativity, and when in
doubt the easiest course is to insert them.  Although Lout allows
symbols to associate towards the left or right, @Code "@Eq" chooses
to have only left associative symbols.  The summary at the end of this
chapter gives the precedence of every symbol.
@PP
The @Code matrix symbol {@PageMark matrix} builds an array of objects:
equations. @RawIndex { equations }
equations.matrix @SubIndex { @Code "matrix" symbol }
matrix.equations @Index { @Code "matrix" symbol (equations) }
@ID {
@Code @Verbatim {
matrix
   atleft { blpar }
   atright { brpar }
{
  row col x sup 2 col y sup 2 col z sup 2
  row col x col y col z
  row col 1 col 1 col 1
}
}
||9ct
@Eq {
matrix
   atleft { blpar }
   atright { brpar }
{
  row col x sup 2 col y sup 2 col z sup 2
  row col x col y col z
  row col 1 col 1 col 1
}
}
}
The @Code atleft and @Code atright options place vertically scaled
equations. @RawIndex { equations }
equations.atleft @SubIndex { @Code "atleft" option }
atleft.equations @Index { @Code "atleft" option (equations) }
equations. @RawIndex { equations }
equations.atright @SubIndex { @Code "atright" option }
atright.equations @Index { @Code "atright" option (equations) }
versions of their values at each side; if either is omitted the value
is taken to be an empty object of zero width by default.  Although
we have used @Code blpar and @Code brpar here, since the options are
vertically scaled to the correct size some people prefer simply
@ID @OneRow @Code @Verbatim {
matrix
   atleft { ( }
   atright { ) }
}
The right parameter of @Code matrix is the array itself.  It must be
enclosed in braces, and it is a sequence of rows introduced by
equations. @RawIndex { equations }
equations.row @SubIndex { @Code "row" symbol }
row.equations @Index { @Code "row" symbol (equations) }
equations. @RawIndex { equations }
equations.col @SubIndex { @Code "col" symbol }
col.equations @Index { @Code "col" symbol (equations) }
@Code row symbols; each row is a sequence of objects introduced by
@Code col symbols.
@FootNote {
Older versions of Lout use different symbols, {@Code "above"} and
{@Code "nextcol"}, at this point.  For backward compatibility these
symbols are still available, but they are obsolete and no longer documented.
}
The @Code row and @Code col symbols have low precedence, but not
as low as white space between two objects.  Therefore, unless the
entries in the array are very simple, it is safest to enclose each of
them in braces.
@PP
Entries built with the @Code col symbol have their objects centred in
the column.  Also available are @Code lcol for left-justified entries,
equations. @RawIndex { equations }
equations.lcol @SubIndex { @Code "lcol" symbol }
lcol.equations @Index { @Code "lcol" symbol (equations) }
@Code ccol meaning the same as {@Code col}, @Code rcol for
equations. @RawIndex { equations }
equations.ccol @SubIndex { @Code "ccol" symbol }
ccol.equations @Index { @Code "ccol" symbol (equations) }
equations. @RawIndex { equations }
equations.rcol @SubIndex { @Code "rcol" symbol }
rcol.equations @Index { @Code "rcol" symbol (equations) }
right-justified entries, and @Code mcol for alignment along column
equations. @RawIndex { equations }
equations.mcol @SubIndex { @Code "mcol" symbol }
mcol.equations @Index { @Code "mcol" symbol (equations) }
marks.  Each column may contain entries of different kinds, except
that @Code mcol does not work well with any other sort.
@PP
When several matrices appear side by side, slight differences in height
can cause an unsightly appearance:
@ID @Eq {
matrix
   atleft { ( }
   atright { ) }
{
   row col a sub 11 col a sub 12
   row col a sub 21 col a sub 22
}
matrix
   atleft { ( }
   atright { ) }
{
   row col b sub 11 col b sub 12
   row col b sub 21 col b sub 22
}
=
matrix
   atleft { ( }
   atright { ) }
{
   row col c sub 11 col c sub 12
   row col c sub 21 col c sub 22
}
}
To assist in resolving this problem, the @Code "matrix" symbol has
a @Code "strut" option, which causes a strut to be inserted into
equations. @RawIndex { equations }
equations.strut @SubIndex { @Code "strut" option }
strut.option. @RawIndex { @Code "strut" option }
strut.option.in.equations @SubIndex { in equations }
every row, guaranteeing that every row has height at least equal
to the height of the strut.  By using
@ID @Code {
"matrix"
"    strut { Yes }"
"..."
}
in each of the three matrices above, the result is improved to
@ID @Eq {
matrix
   atleft { ( }
   atright { ) }
   strut { Yes }
{
   row col a sub 11 col a sub 12
   row col a sub 21 col a sub 22
}
matrix
   atleft { ( }
   atright { ) }
   strut { Yes }
{
   row col b sub 11 col b sub 12
   row col b sub 21 col b sub 22
}
=
matrix
   atleft { ( }
   atright { ) }
   strut { Yes }
{
   row col c sub 11 col c sub 12
   row col c sub 21 col c sub 22
}
}
By default, the strut has height @Code "0.5f" (half the current font
size) both above and below the axis of the row.  This can be changed
by giving any length as the value of the @Code "strut" option:
@Code "strut { 2.0c }" for two centimetres above and below
the axis, and so on.
@PP
Some symbols have been added which produce `matrices' with commonly needed
@Code atleft and @Code atright options already set for you.  Here are
these symbols, on the left, with the equivalent @Code matrix symbol
and, on the right, the result produced:
@ID @Tab
    @Fmta { @Col @Code A ! @Col ! @Col @Code B ! @Col ! @Col C }
{
@Rowa
    A { "pmatrix" }
    B { "matrix atleft { ( } atright { ) } { M }" }
    C { @Eq { pmatrix { M } }
equations. @RawIndex { equations }
equations.pmatrix @SubIndex { @Code "pmatrix" symbol }
pmatrix.equations @Index { @Code "pmatrix" symbol (equations) }
}
@Rowa
    A { "bmatrix" }
    B { "matrix atleft { blbrack } atright { brbrack } { M }" }
    C { @Eq { bmatrix { M } }
equations. @RawIndex { equations }
equations.bmatrix @SubIndex { @Code "bmatrix" symbol }
bmatrix.equations @Index { @Code "bmatrix" symbol (equations) }
}
@Rowa
    A { "brmatrix" }
    B { "matrix atleft { blbrace } atright { brbrace } { M }" }
    C { @Eq { brmatrix { M } }
equations. @RawIndex { equations }
equations.brmatrix @SubIndex { @Code "brmatrix" symbol }
brmatrix.equations @Index { @Code "brmatrix" symbol (equations) }
}
@Rowa
    A { "fmatrix" }
    B { "matrix atleft { blfloor } atright { brfloor } { M }" }
    C { @Eq { fmatrix { M } }
equations. @RawIndex { equations }
equations.fmatrix @SubIndex { @Code "fmatrix" symbol }
fmatrix.equations @Index { @Code "fmatrix" symbol (equations) }
}
@Rowa
    A { "cmatrix" }
    B { "matrix atleft { blceil } atright { brceil } { M }" }
    C { @Eq { cmatrix { M } }
equations. @RawIndex { equations }
equations.cmatrix @SubIndex { @Code "cmatrix" symbol }
cmatrix.equations @Index { @Code "cmatrix" symbol (equations) }
}
@Rowa
    A { "amatrix" }
    B { "matrix atleft { blangle } atright { brangle } { M }" }
    C { @Eq { amatrix { M } }
equations. @RawIndex { equations }
equations.amatrix @SubIndex { @Code "amatrix" symbol }
amatrix.equations @Index { @Code "amatrix" symbol (equations) }
}
}
For example:
@ID {
@Code {
"fmatrix { (n+1) over 2 }"
}
|7ct
@Eq {
fmatrix { (n+1) over 2 }
}
}
As this example shows, these symbols are very useful for getting large
scaled delimiters around things that aren't necessarily matrices at all.
@PP
Each of the @Code "@Eq" symbols that takes parameters also has a @Code gap
equations. @RawIndex { equations }
equations.gap @SubIndex { @Code "gap" option }
gap.equations @Index { @Code "gap" option (equations) }
option, which controls the amount of space inserted by the symbol:
@IL
@LI {
@Code "x over y"
|7ct
@Eq { x over y }
}
@LI {
6c @Wide @Code "x over gap { 3p } y"
|7ct
@Eq { x over gap { 3p } y }
}
@EL
@Code "@Eq" usually gets the spacing right without help.
@End @Section
