aboutsummaryrefslogtreecommitdiffstats
path: root/doc/expert/det_name
blob: ae3dac2386f6719a2d93438136fd05414ea78c05 (plain) (blame)
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
@Section
  @Tag { named }
  @Title { Named parameters }
@Begin
@PP
In addition to left and right (or body) parameters, a symbol may have
any number of {@I {named parameters}}:
parameter.named @SubIndex { @Code named parameter }
named.par @Index { @Code named parameter }
@ID @OneRow @Code  {
"def @Chapter"
"    named @Tag {}"
"    named @Title {}"
"    right x"
"{"
"    ..."
"}"
}
Their definitions appear in between those of any left and right
parameters, and each is followed by a @I {default value} between
default @Index { Default value of parameter }
braces.  When @Code "@Chapter" is invoked, its named parameters are
given values in the following way:
@ID @OneRow @Code  {
"@Chapter"
"    @Tag { intro }"
"    @Title { Introduction }"
"{"
"    ..."
"}"
}
That is, a list of named parameters appears immediately following the
symbol, each with its value enclosed in braces.  Any right parameter
follows after them.  They do not have to appear in the order they were
defined, and they can even be omitted altogether, in which case the
default value from the definition is used instead.
@PP
If the keyword @Code "compulsory" appears after @Code "named" and
before the parameter's name, Lout will print a warning message whenever
this parameter is missing.  However it will still use the default value
as just described.
@PP
A named @Code "@Tag" parameter
tag.par @Index { @Code "@Tag" parameter, default value of }
does not take its default value from the definition; instead, if a default
value is needed, Lout invents a simple word which differs from every other
tag.  This is important, for example, in the production of numbered
chapters and sections (Section {@NumberOf chapters}).  The same thing occurs
if there is a @Code "@Tag" parameter but its value is the empty object:  the
value will be replaced by an invented one.
@PP
Named parameters may have parameters, {@PageMark strange} as in the
following definition:
@ID @OneRow @Code {
"def @Strange"
"    named @Format right @Val { [@Val] }"
"    right x"
"{"
"    @Format x"
"}"
}
The named parameter @Code "@Format" has right parameter {@Code "@Val"},
and the default value of @Code "@Format" is this parameter enclosed in
brackets.  When @Code "@Format" is invoked it must be supplied with
a right parameter, which will replace {@Code "@Val"}.  Thus,
@ID @Code {
"@Strange 27"
}
equals @Code "@Format 27" and so has result
@ID {
@Strange 27
}
The @Code "@Format" symbol is like a definition with parameters whose
body can be changed:
@ID @OneRow @Code {
"@Strange"
"    @Format { Slope @Font @Val. }"
"27"
}
still equals {@Code "@Format 27"}, but this time the result is
@ID {
@Strange
    @Format { Slope @Font @Val. }
27
}
In practice, examples of named parameters with parameters all have this
flavour of format being separated from content; running headers (Section
{@NumberOf pagelayout}) and printing styles for bibliographies
(Section {@NumberOf biblio}) are two major ones.
@End @Section