home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
APPS
/
lout2.lzh
/
LOUT2
/
DOC
/
TR.LOUT
/
ch1.03
< prev
next >
Wrap
Text File
|
1994-01-25
|
4KB
|
97 lines
@Section
@Tag { cross }
@Title { Cross references }
@Begin
@PP
A cross reference
cross.ref @Index { Cross reference }
in common terminology is something like `see Table 6'
or `see page 57' -- a reference within a document to some other part of
the document. Readers find them very useful, but they are a major
bookkeeping problem for authors. As the document is revised, Table 6
becomes Table 7, the thing on page 57 moves to page 63, and all the
cross references must be changed.
@PP
The Scribe
scribe @Index { Scribe }
document formatter, developed by Brian K. Reid [{@Ref reid80}],
reid.brian @Index { Reid, Brian K. }
introduced a scheme for keeping track of cross
references. It allows you to give names to tables, figures, etc., and to
refer to them by name. The formatter inserts the appropriate numbers in
place of the names, so that as the document is revised, the
cross references are kept up to date automatically. Lout has adopted
and extended this scheme.
@PP
In Lout, automatic cross referencing works in the following way. First
define a symbol with a parameter with the special name @Code "@Tag":
@ID @Code {
"def @Table"
" left @Tag"
" right @Value"
"{"
" ||1i @Value"
"}"
}
When this symbol is invoked, the value given to @Code "@Tag" should be a
simple word like {@Code "cities"}, or several simple words juxtaposed
like {@Code "cities.compare"}; it serves to name the invocation:
@ID @Code {
"cities @Table"
"{"
" Washington |0.5i Canberra"
"}"
}
We may now refer to this invocation elsewhere in the document, using the
@I {cross reference} @Code "@Table&&cities". Here @Code "&&" is the
{@I {cross reference symbol}}; its left parameter is a symbol and its right
parameter is the value of the @Code "@Tag" parameter of some invocation
of that symbol.
@PP
A cross reference is not an object; the reader should think of it as
an arrow in the final printed document, beginning at the cross reference
symbol and ending at the top of the target
target @Index { Target of cross reference }
invocation, like this:
@ID 8p @Font {
{ @LittlePage // @LittlePage }
||0io ||0.7c
{ //2c
{ @Code "@Table&&cities" }
//0.1c
||0.5c 90d @Rotate @Arrow 2.5c
//0.05c
@HContract @VContract
@Fig { @Box margin { 0c } paint { grey } { 1.5c @Wide 1c @High } }
}
}
@PP
Two special values may be given to the right parameter of
{@Code "&&"}: @Code preceding
preceding. @Index { @Code preceding }
following. @Index { @Code following }
and
@Code following. The cross
reference @Code "@Table&&preceding" points to some table
appearing earlier in the final printed document than itself; that is, the
arrow is guaranteed to point backwards through the document. Usually it
points to the nearest preceding invocation. Similarly,
@Code "@Table&&following" points forwards, usually to the
nearest following invocation of @Code "@Table".
@PP
This section has been concerned with what a cross reference is -- an
arrow from one point in a document to another -- but not with how it is
used. One simple way to use a cross reference is to put it where an
object is expected, like this:
@ID @Code {
"a | @Table&&cities | c"
}
In this case the cross reference will be replaced by a copy of the
invocation it points to: in the example just given, a table will appear
between @Code a and @Code c. Other applications of cross references may be
found in Chapter {@NumberOf examples}, including finding the number of
the page where something appears, producing running page headers and footers,
and accessing databases of Roman numerals, references, etc. Cross
references are also used by galleys, as will be explained in the next section.
@End @Section