| 1 |
\input pitex % which \input's YaX |
| 2 |
|
| 3 |
\setparameter document: |
| 4 |
author = "Paul Isambert" |
| 5 |
title = \yax |
| 6 |
pdftitle = YaX |
| 7 |
version = \yaxversion |
| 8 |
date = "\the\month/\the\day/\the\year" |
| 9 |
display = outlines |
| 10 |
subject = "The YaX documentation." |
| 11 |
|
| 12 |
\setparameter navigator: |
| 13 |
mode = outlines |
| 14 |
|
| 15 |
\setparameter page: |
| 16 |
left = 5cm |
| 17 |
right = 3cm |
| 18 |
height = 26cm |
| 19 |
|
| 20 |
\setparameter font : |
| 21 |
command = \mainfont |
| 22 |
name = ChaparralPro- |
| 23 |
roman = Regular |
| 24 |
italic = Italic |
| 25 |
bold = Bold |
| 26 |
|
| 27 |
\setparameter font : |
| 28 |
command = \sectionfont |
| 29 |
size = 13pt |
| 30 |
name = ChaparralPro- |
| 31 |
roman = Regular |
| 32 |
italic = Italic |
| 33 |
|
| 34 |
\setparameter font : |
| 35 |
command = \titlefont |
| 36 |
size = 26pt |
| 37 |
name = ChaparralPro- |
| 38 |
roman = Regular |
| 39 |
|
| 40 |
\setparameter font: |
| 41 |
command = \codefont |
| 42 |
name = lucon |
| 43 |
size = 8.1pt |
| 44 |
type = ttf |
| 45 |
roman = {} |
| 46 |
features = "\usevalue metafont:features -trep;" |
| 47 |
|
| 48 |
\setparameter section: |
| 49 |
font = \sectionfont |
| 50 |
number = none |
| 51 |
color = ".8 0 0" |
| 52 |
|
| 53 |
\setparameter sectionbookmark: |
| 54 |
meta = navigator |
| 55 |
up = 15pt |
| 56 |
|
| 57 |
|
| 58 |
\pdfdef\ital#1{#1} |
| 59 |
|
| 60 |
|
| 61 |
\def\yax{% |
| 62 |
Y\kern-.1em \raise.15em\hbox{\sc a}\kern-.1em \lower.15em\hbox{X}% |
| 63 |
\ifcatnext a { }{\iffnext({ }}% |
| 64 |
} |
| 65 |
\def\defarg#1#2{% |
| 66 |
\def#1{\arg{#2}\kern1pt\antigobblespace}% |
| 67 |
} |
| 68 |
\defarg\param{parameter} \defarg\paralist{list of parameters} |
| 69 |
\defarg\attr{attribute} \defarg\attrlist{list of attributes} |
| 70 |
\def\paramatt{\param\kern-1pt\tcode:\attr\antigobblespace} |
| 71 |
\defarg\attrlist{list of attributes} \defarg\vallist{list of values} |
| 72 |
\defarg\value{value} \defarg\ospace{optional space} |
| 73 |
\defarg\andvalue{value exists} \defarg\orvalue{no value} |
| 74 |
\defarg\true{true} \defarg\false{false} |
| 75 |
\defarg\codarg{code} \defarg\comarg{command} |
| 76 |
\newif\ifdescribebookmark |
| 77 |
\def\describe{% |
| 78 |
\ifnext*{\describebookmarktrue\gobbleoneand\Describe} |
| 79 |
{\describebookmarkfalse\Describe}% |
| 80 |
} |
| 81 |
\def\Describe{% |
| 82 |
\ifnext!{\gobbleoneand{\let\COM\ecom\DoDescribe}} |
| 83 |
{\let\COM\com\DoDescribe}% |
| 84 |
} |
| 85 |
\def\ecom#1{{\mainfont\char"E01F}\com{#1}} |
| 86 |
\long\def\DoDescribe#1#2.{% |
| 87 |
\ifvmode \vskip\baselineskip \fi |
| 88 |
\noindent |
| 89 |
\ifdescribebookmark |
| 90 |
\outline[color = .4 .4 .4]{3}{\noexpand#1}% |
| 91 |
\fi |
| 92 |
\llap{\color{.8 0 0}{\COM#1}\iffemptystring{#2}{\kern1em}}#2% |
| 93 |
\reverse\iffemptystring{#2}{\par\noindent}\ignorespaces |
| 94 |
} |
| 95 |
|
| 96 |
\newblock*\syntax{\vskip\baselineskip\codefont\setcatcodes{\^^M=13}\obeylines} |
| 97 |
{\vskip\baselineskip} |
| 98 |
\extraboxspace=10pt |
| 99 |
|
| 100 |
\newbox\codebox |
| 101 |
\newbox\processbox |
| 102 |
\newdimen\prevcodedepth |
| 103 |
\def\processexample{% |
| 104 |
\setbox\codebox=\vtop{% |
| 105 |
\let\exampleskip\relax |
| 106 |
\parindent0pt |
| 107 |
\hsize.75\hsize |
| 108 |
\typesetexample |
| 109 |
\par |
| 110 |
\global\prevcodedepth=\prevdepth |
| 111 |
}% |
| 112 |
\setbox\processbox=\vtop{% |
| 113 |
\parindent0pt |
| 114 |
\hsize.5\hsize |
| 115 |
\doexample |
| 116 |
}% |
| 117 |
\exampleskip\exampleskip |
| 118 |
\moveleft .25\hsize\hbox{\colorbox{.9 .9 .9}{\copy\codebox\copy\processbox}}% |
| 119 |
\exampleskip\exampleskip |
| 120 |
\prevdepth=\prevcodedepth |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
%\output{% |
| 125 |
% \shipout\vbox to\dimexpr(\vsize+3\baselineskip){% |
| 126 |
% \box255 |
| 127 |
% \vfil |
| 128 |
% \hbox to\hsize{\mainfont\hfil\the\pageno\hfil}% |
| 129 |
% } |
| 130 |
% \advancepageno |
| 131 |
% } |
| 132 |
% |
| 133 |
|
| 134 |
\gates def {headers}{% |
| 135 |
\setbox255=\vbox to\dimexpr(\outputsize+3\baselineskip){% |
| 136 |
\box255 |
| 137 |
\vfil |
| 138 |
\hbox to\hsize{\mainfont\hfil\the\pageno\hfil}% |
| 139 |
}% |
| 140 |
} |
| 141 |
|
| 142 |
\gates def {ship}{% |
| 143 |
\shipout\box255 |
| 144 |
} |
| 145 |
|
| 146 |
\vbox to 2\baselineskip{% |
| 147 |
\vfil |
| 148 |
\hbox to\hsize{\hfil\titlefont \usevalue document : title } |
| 149 |
\vfil} |
| 150 |
|
| 151 |
\vskip\baselineskip |
| 152 |
\it |
| 153 |
\hfill \usevalue document : author \par |
| 154 |
\hfill \usevalue document : date \par |
| 155 |
\hfill v.\usevalue document : version \par |
| 156 |
|
| 157 |
\rm |
| 158 |
|
| 159 |
\vskip2\baselineskip |
| 160 |
|
| 161 |
|
| 162 |
\noindent\yax is Yet Another Key System, or \yax Ain't Keys, however you want it. |
| 163 |
It has some peculiarities. First, keys are not keys, but attributes, |
| 164 |
which means they depend on a parameter. You don't set key individually |
| 165 |
in \yax (although you can do it), you define parameters, which have |
| 166 |
attributes, which have values. Second, parameters can have definitions, |
| 167 |
so that when you set it you can also execute a command, or execute it |
| 168 |
later; thus, \yax is halfway between key management and macro definition. |
| 169 |
Finally, the syntax of \yax is not traditional: there are as few braces |
| 170 |
as possible, which you can find tremendously annoying, but it can be |
| 171 |
changed. |
| 172 |
|
| 173 |
And, of course, \yax is format-independant. Files are provided for |
| 174 |
La\TeX\ and Con\TeX t, so you can input it with \verb/\usepackage{yax}/ |
| 175 |
or \verb/\usemodule[yax]/ respectively; anywhere else just use \verb/\input yax/. |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
\describe!\yaxversion. |
| 180 |
Starting with version 1.01, this macro holds \yax's version. Current is \yaxversion. |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
\section{Setting parameters} |
| 186 |
|
| 187 |
\noindent Here's an example of how values are set: |
| 188 |
|
| 189 |
\example |
| 190 |
\setparameter Zappa : |
| 191 |
firstname = Frank |
| 192 |
motto = "Music is the best" |
| 193 |
hairstyle = \moustache |
| 194 |
\example/ |
| 195 |
|
| 196 |
\noindent Here we have defined a \ital{parameter}, `\verb/Zappa/', which |
| 197 |
has \ital{attributes} `\verb/firstname/', `\verb/motto/' and `\verb/hairstyle/' |
| 198 |
with \ital{values} `\verb/Frank/', `\verb/Music is the best/' and `\verb/\moustache/' |
| 199 |
respectively. |
| 200 |
|
| 201 |
\describe*\setparameter. |
| 202 |
Here's how you set parameters more precisely. (This command is not the only way to set values. |
| 203 |
See below.) |
| 204 |
Its simplified syntax is as follows: |
| 205 |
|
| 206 |
\syntax |
| 207 |
\noindent\com\setparameter \paralist\ : |
| 208 |
\attrlist\ = \value |
| 209 |
\attrlist\ = \value |
| 210 |
... |
| 211 |
\noindent\com\par |
| 212 |
\syntax/ |
| 213 |
|
| 214 |
\noindent First, the \com\par command that terminates the declaration: |
| 215 |
it was not chosen simply because it echoes \ital{parameter}, but above |
| 216 |
all because it can be implicit in a blank line, i.e. \com\setparameter |
| 217 |
can be delimited by a blank line. That's why in the first example there |
| 218 |
seemed to be nothing delimitating \com\setparameter: it is supposed to |
| 219 |
be followed by a blank line. I will regularly display parameter setting in this |
| 220 |
fashion, even though the following would be equally legitimate: |
| 221 |
|
| 222 |
\example |
| 223 |
\setparameter Zappa : firstname = Frank ... \par |
| 224 |
\example/ |
| 225 |
|
| 226 |
\noindent barring readibility, obviously. |
| 227 |
|
| 228 |
As for the detail, \paralist is a list of space-delimited parameters, |
| 229 |
followed by a colon. Any space before the colon is removed, that's why |
| 230 |
|
| 231 |
\example |
| 232 |
\setparameter Zappa Boulez: ... \par |
| 233 |
\setparameter Zappa Boulez : ... \par |
| 234 |
\example/ |
| 235 |
|
| 236 |
\noindent set the attributes of the same \verb/Zappa/ and \verb/Boulez/ parameters. |
| 237 |
Which means, of course, that you can set the attributes of as many parameters |
| 238 |
as you wish by doing so. |
| 239 |
|
| 240 |
The name of each parameter should be fully expandable. It can contain spaces, |
| 241 |
but then it should be enclosed between braces, since space delimits parameters |
| 242 |
in \paralist. |
| 243 |
|
| 244 |
Finally, you can use \com\setparameter several times on the same parameter(s), |
| 245 |
by default it does the same thing as using one big \com\setparameter. I say |
| 246 |
\ital{by default}, because things might occur between the two calls, e.g. the |
| 247 |
parameter might be active and have deleted its own attributes after the first |
| 248 |
call, which anyway is something we'll see later. |
| 249 |
|
| 250 |
Like \paralist, \attrlist is a list of space-delimited attributes. |
| 251 |
Each \attr is made of the same thing as a \param: i.e. anything expandable. |
| 252 |
However, at the beginning of a \attrlist, the strings \verb/e:/, \verb/g:/ and \verb/x:/ |
| 253 |
have a special meaning: these prefixes are used to specify |
| 254 |
how an attribute or list of attributes is to be defined, and they are similar to \com\edef, |
| 255 |
\com\gdef and \com\xdef (with no prefix meaning \com\def), i.e.: |
| 256 |
|
| 257 |
\example |
| 258 |
\setparameter foo : |
| 259 |
one = \whatever |
| 260 |
e: two = \whatever |
| 261 |
g: three = \whatever |
| 262 |
x: four five = \whatever |
| 263 |
\example/ |
| 264 |
|
| 265 |
\noindent defines, for the parameter \verb/foo/, the attributes \verb/one/ |
| 266 |
and \verb/three/ as \com\whatever and the attributes \verb/two/, \verb/four/ and \verb/five/ |
| 267 |
as the full expansion of \com\whatever; moreover, \verb/one/ and \verb/two/ |
| 268 |
are locally defined, whereas \verb/three/, \verb/four/ and \verb/five/ are globally |
| 269 |
defined. The space between the prefix and the name of the parameter is |
| 270 |
optional. |
| 271 |
|
| 272 |
Finally, \value may be given in three ways. First, it can be delimited by |
| 273 |
a space, e.g.: |
| 274 |
|
| 275 |
\example |
| 276 |
\setparameter Zappa : |
| 277 |
firstname = Frank |
| 278 |
motto = {Music is the best} |
| 279 |
... |
| 280 |
\example/ |
| 281 |
|
| 282 |
\noindent here the space is simply the end of the line. The spaces in |
| 283 |
\verb/Music is the best/ aren't seen, because of the braces (which will |
| 284 |
be removed from the value). Don't forget that control sequences eats |
| 285 |
the subsequent space, hence a control sequence can't be at the end of |
| 286 |
a value supposedly delimited by space without braces. Actually, it can't be at |
| 287 |
the beginning either (see below). |
| 288 |
|
| 289 |
Otherwise, \arg{value} can be given between double quotes: |
| 290 |
|
| 291 |
\example |
| 292 |
\setparameter Zappa : |
| 293 |
firstname = "Frank" |
| 294 |
motto = "Music is the best" |
| 295 |
hairstyle = "\mustache" |
| 296 |
\example/ |
| 297 |
|
| 298 |
\noindent which basically act as braces. The space inserted here by the |
| 299 |
end of the line is optional and the following can be done: |
| 300 |
|
| 301 |
\example |
| 302 |
\setparameter Zappa:firstname="Frank"motto="Music is the best"...\par |
| 303 |
\example/ |
| 304 |
|
| 305 |
\noindent Finally, there's a special rule. Control sequences gobble the |
| 306 |
next space, but a \value can be made of one and only one control sequence, |
| 307 |
e.g.: |
| 308 |
|
| 309 |
\example |
| 310 |
\setparameter Zappa : |
| 311 |
hairstyle = \mustache |
| 312 |
... |
| 313 |
\example/ |
| 314 |
|
| 315 |
\noindent i.e. if \yax sees a control sequence at the beginning of a value |
| 316 |
it will take this control sequence only as \arg{value}, which means that |
| 317 |
anything thereafter will be considered as belonging to the next \param |
| 318 |
name. Hence, all the following are bad ideas: |
| 319 |
|
| 320 |
\example |
| 321 |
\setparameter bad values : |
| 322 |
% the space stops the value to "bad" |
| 323 |
one = bad space |
| 324 |
% the control sequence is taken as the only token |
| 325 |
two = \control sequence |
| 326 |
% "\sequence" eats the delimitating space |
| 327 |
three = control\sequence |
| 328 |
\example/ |
| 329 |
|
| 330 |
\noindent but they'd all be ok with quotes or braces (which |
| 331 |
still require a space after): |
| 332 |
|
| 333 |
\example |
| 334 |
\setparameter good values : |
| 335 |
one = "bad space" |
| 336 |
two = "\control sequence" |
| 337 |
three = {control\sequence} |
| 338 |
four = \LonelyCommand |
| 339 |
five = "\Command\Command" |
| 340 |
... |
| 341 |
\example/ |
| 342 |
|
| 343 |
\noindent Finally, they are some exceptions to this rule: first, |
| 344 |
always put \com\par between braces, otherwise it will be seen |
| 345 |
as the end of the parameter. Second, always put a character denotation |
| 346 |
between either braces or quotes, even if it's the only control sequence. |
| 347 |
If you don't know what character denotation means, never mind. Just remember |
| 348 |
that \com\bgroup and \com\egroup are character denotations. |
| 349 |
|
| 350 |
Now I'm sure you ask: what is this lousy syntax? An answer is I don't |
| 351 |
like braces. Another answer is \yax is not designed to store complicated |
| 352 |
strings, although it can do it. Instead it aims at setting simple values |
| 353 |
in an orderly fasion, e.g.: |
| 354 |
|
| 355 |
\example |
| 356 |
\setparameter page : |
| 357 |
pagewidth = 30cm |
| 358 |
pageheight = 32cm |
| 359 |
top bottom = 2cm |
| 360 |
lines = 45 |
| 361 |
whatever = \foo |
| 362 |
... |
| 363 |
\example/ |
| 364 |
|
| 365 |
\noindent in which case it is very handy, especially when you're in a hurry: |
| 366 |
|
| 367 |
\example |
| 368 |
\setparameter page: pagewidth=32cm pageheight=30cm whatever=\foo...\par |
| 369 |
\example/ |
| 370 |
|
| 371 |
\noindent Thus, I find commas to delimit values equally superfluous and find |
| 372 |
the odd quote better. |
| 373 |
|
| 374 |
However, good old key-value pairs separated by commas happen to be useful |
| 375 |
too, for instance when a command takes some options. Hence the following |
| 376 |
was introduced in v.\yaxversion: |
| 377 |
|
| 378 |
\describe*\setparameterlist\paralist\oarg{optional macro}\arg{attribute(s) = value list}. |
| 379 |
This produces exactly the same thing as \com\setparameter, only the syntax |
| 380 |
changes. Ignoring the optional argument in the middle, our example just above |
| 381 |
would be rewritten as: |
| 382 |
|
| 383 |
\example |
| 384 |
\setparameterlist{page}{pagewidth = 32cm, pageheight = 30cm, whatever=\foo} |
| 385 |
\example/ |
| 386 |
|
| 387 |
\noindent Here you can forget about how values are given: the delimiter is |
| 388 |
the comma, end of story. There can be several parameters in the first argument, |
| 389 |
and several attributes before each `\verb"="' sign in the second; in both cases, |
| 390 |
they are separated by spaces, as above. Also, each list of attributes can be |
| 391 |
prefixed with \verb"e:", \verb"g:" and \verb"x:", again as with \com\setparameter. |
| 392 |
Finally, as shown in the example, space is trimmed away. |
| 393 |
|
| 394 |
But \com\setparameterlist has a feature that \com\setparameter doesn't have. |
| 395 |
If one of the \attr = \value pair doesn't contain a `\verb"="', i.e. if it |
| 396 |
isn't a pair at all, then one of the following happens: if there is no |
| 397 |
\arg{optional macro}, then the default value `\verb"true"' is assigned to |
| 398 |
all the attributes mentionned; besides, the entry can still be prefixed with |
| 399 |
\verb"e:", \verb"g:" or \verb"x:". For instance, the following two statements |
| 400 |
are equivalent: |
| 401 |
|
| 402 |
\example |
| 403 |
\setparameterlist{Zappa}{guitarist composer} |
| 404 |
\setparameterlist{Zappa}{guitarist composer = true} |
| 405 |
\example/ |
| 406 |
|
| 407 |
On the other hand, if the \arg{optional macro} is present, then it should |
| 408 |
take one argument, and the entry is passed to it (trimmed, though). What |
| 409 |
happens then is none of \yax's concern, although of course the macro can |
| 410 |
itself set parameters. For instance, in the following, \verb"a" and \verb"b" |
| 411 |
will be set to `\verb"what"' and `\verb"are you kidding"', whereas `\verb"eddie?"' |
| 412 |
is passed to \com\dosomething. |
| 413 |
|
| 414 |
\example |
| 415 |
\def\dosomething#1{ ... #1 ... } |
| 416 |
\setparameter{whatever}[\dosomething]{a = what, b = are you kidding, eddie?} |
| 417 |
\example/ |
| 418 |
|
| 419 |
Another way to set a parameter is as follows: |
| 420 |
|
| 421 |
\describe*\copyparameter\paralist:\param\arg{space}. |
| 422 |
\describe\gcopyparameter\paralist:\param\arg{space}. |
| 423 |
All the attributes of the parameters in \paralist are copied |
| 424 |
to \param; if the latter already has some attributes, they're |
| 425 |
aren't deleted (but you can use \com\deleteparameter beforehand, |
| 426 |
see below) although they might be overwritten. If several parameters |
| 427 |
in \paralist have the same attribute, the value of the last parameter |
| 428 |
in the list wins. The difference between the two versions is that |
| 429 |
the second is global. The space shouldn't be forgotten, it's the |
| 430 |
same as explained in the \paramatt syntax \jumplink{values}{\ital{below}}. |
| 431 |
|
| 432 |
|
| 433 |
Finally, here's one fast way of setting a single attribute: |
| 434 |
|
| 435 |
\describe*\setattribute\paramatt=\value\arg{space}. |
| 436 |
\describe\esetattribute\paramatt=\value\arg{space}. |
| 437 |
\describe\gsetattribute\paramatt=\value\arg{space}. |
| 438 |
\describe\xsetattribute\paramatt=\value\arg{space}. |
| 439 |
This sets \attr (no list) for \param (no list) to \value; see |
| 440 |
\jumplink{values}{\ital{below}} for the \paramatt syntax. Note that the \arg{space} is for real, |
| 441 |
so don't forget it. The `=' sign may be surrounded by optional space. |
| 442 |
This command can be used instead of \com\setparameter for two reasons: |
| 443 |
first, it is much faster (because it doesn't take lists into account); |
| 444 |
second, if \param is active it is \ital{not} executed (see the section |
| 445 |
\jumplink{defpar}{\ital{Defining parameters}}). |
| 446 |
The \verb"e-", \verb"g-" and \verb"x-"versions sets the attribute |
| 447 |
with the \verb"e:", \verb"g:" and \verb"x:" prefixes respectively. |
| 448 |
|
| 449 |
\describe*\deleteattribute\paramatt. |
| 450 |
\describe\gdeleteattribute\paramatt. |
| 451 |
This deletes \paramatt, which now responds negatively |
| 452 |
to all previous commands, as if it was never defined. |
| 453 |
The second version makes this deletion global, the first |
| 454 |
keeps it local. |
| 455 |
|
| 456 |
\describe*\deleteparameter\paralist:. |
| 457 |
\describe\gdeleteparameter\paralist:. |
| 458 |
This deletes all paramaters in \paralist; it is equivalent to using |
| 459 |
the previous command on all the parameters' attributes. The |
| 460 |
first version is local, the second is global. And yes, the colon is |
| 461 |
really there, although it might get away. |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
\sectioncommand{section}{The meta attribute}{The \ital{meta} attribute} |
| 466 |
\noindent You can give any attribute to any parameter (unless they're restricted, |
| 467 |
but that's not the point for the time being). |
| 468 |
However, there's one particular attribute which has a special meaning: \verb/meta/. |
| 469 |
The value of \verb/meta/ should be another parameter. Then, when querying |
| 470 |
the value of an attribute, say \verb/attr/, for a given parameter, say \verb/param/, |
| 471 |
\yax will do the following: if \verb/param/ has \verb/attr/, it is returned. |
| 472 |
Otherwise, if \verb/param/ has a \verb/meta/ attribute, whose value is for instance |
| 473 |
\verb/metaparam/, then \verb/attr/ is queried for the value of \verb/metaparam/. |
| 474 |
And if \verb/metaparam/ has no \verb/attr/ but has a \verb/meta/ attribute, |
| 475 |
this process continues, until either a parameter is found with \verb/attr/ |
| 476 |
or there are no new \verb/meta/. For instance: |
| 477 |
|
| 478 |
\example |
| 479 |
\setparameter A : attr = value ... \par |
| 480 |
\setparameter B : meta = A ... \par |
| 481 |
\setparameter C : meta = B ... \par |
| 482 |
\example/ |
| 483 |
|
| 484 |
\noindent If parameter \verb/C/ has no \verb/attr/, then it retrieves it |
| 485 |
from parameter \verb/A/ via \verb/B/ (or from \verb/B/ if it has one). On |
| 486 |
the other hand, if \verb/C/ has \verb/attr/, then its own value is returned. |
| 487 |
You can also query the value of an attribute for a parameter and forbid the |
| 488 |
search for \verb/meta/'s, as explained in the next section. |
| 489 |
|
| 490 |
Don't be afraid to create loop with \verb/meta/. The following is perfectly |
| 491 |
legitimate: |
| 492 |
|
| 493 |
\example |
| 494 |
\setparameter A : meta = C ... \par |
| 495 |
\setparameter B : meta = A ... \par |
| 496 |
\setparameter C : meta = B ... \par |
| 497 |
\example/ |
| 498 |
|
| 499 |
\noindent and it can even be useful. \yax detects loops when searching |
| 500 |
\verb/meta/ paths and stops in time (with no value, obviously). Finally, |
| 501 |
you can set \verb/meta/ to a parameter that doesn't exist. It will simply |
| 502 |
return no value. |
| 503 |
|
| 504 |
The use of \verb/meta/ is useful to create families |
| 505 |
of parameters and/or to set default values, e.g.: |
| 506 |
|
| 507 |
\example |
| 508 |
\setparameter mammal : |
| 509 |
egg = no |
| 510 |
fur = yes |
| 511 |
... |
| 512 |
\setparameter cat whale : |
| 513 |
meta = mammal |
| 514 |
... |
| 515 |
\setparameter cat : \setparameter whale : |
| 516 |
foot = clawed fur = no |
| 517 |
tooth = fang foot = flipper |
| 518 |
... tooth = baleen |
| 519 |
... |
| 520 |
\setparameter tiger mykitty : |
| 521 |
meta = cat |
| 522 |
stripped = yes |
| 523 |
... |
| 524 |
\setparameter tiger : \setparameter mykitty : |
| 525 |
foot = "very bad news" foot = "bad news" |
| 526 |
... ... |
| 527 |
\example/ |
| 528 |
|
| 529 |
Apart from that, \verb/meta/ behaves as any other attribute, i.e. it can |
| 530 |
be freely set and queried. |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
\section{Using values}[values] |
| 540 |
|
| 541 |
\noindent Once attributes have been set, they can be queried by the macros |
| 542 |
that follow. But first, one last bit of odd syntax: \paramatt means anything |
| 543 |
up to the colon as the \param and then anything up to the next space as |
| 544 |
the \attr. That's the reason why space in attribute names is a bad idea: |
| 545 |
the space is the main delimitator when using attributes. It is gobbled |
| 546 |
in the process. On the other hand, |
| 547 |
any space surrounding the colon is removed, so that `\verb/zappa:hairstyle/ ' |
| 548 |
and `\verb/zappa : hairstyle/ ' denote the same attribute of the same parameter. |
| 549 |
Good news, though: if you don't like that syntax, the next section explains |
| 550 |
how to create commands with the same meaning but a different syntax. |
| 551 |
|
| 552 |
In what follows, fully expandable commands are marked with \color{.8 0 0}{\char"E01F}. |
| 553 |
|
| 554 |
\describe*!\nometa\arg{command}. |
| 555 |
All the commands that follow except \com\parameterloop can be prefixed with \com\nometa. In this case, |
| 556 |
\yax will return the value of the attribute for the specified parameter, |
| 557 |
as usual, or return no value, i.e. it will not search \verb/meta/ parameters. |
| 558 |
So, in what follows, `\paramatt is defined' means two things. If \com\nometa |
| 559 |
isn't used, it means that \param has \attr or it has a metaparameter with |
| 560 |
\attr; on the other hand, if \com\nometa is used, it means that \param has |
| 561 |
\attr, end of story. |
| 562 |
|
| 563 |
\describe*!\ifattribute\paramatt\true\false. |
| 564 |
This returns \true if \paramatt is defined, \false otherwise. Since all |
| 565 |
commands below always check whether \paramatt is defined before trying |
| 566 |
to do anything with the value, this command can be avoided most of the |
| 567 |
time. |
| 568 |
|
| 569 |
\setparameter musician : |
| 570 |
job = music |
| 571 |
|
| 572 |
\setparameter Zappa : |
| 573 |
meta = musician |
| 574 |
firstname = Frank |
| 575 |
|
| 576 |
|
| 577 |
\Example |
| 578 |
\setparameter musician : job = music\par |
| 579 |
\setparameter Zappa : |
| 580 |
meta = musician |
| 581 |
firstname = Frank |
| 582 |
|
| 583 |
% See this space? |
| 584 |
\ifattribute Zappa : job {Good, it is.}{...}\par |
| 585 |
\nometa\ifattribute Zappa : job {...}{Too bad.} |
| 586 |
\Example/ |
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
\describe*!\usevalue\paramatt. |
| 593 |
\describe!\usevalueor\paramatt\orvalue. |
| 594 |
\describe!\usevalueand\paramatt\andvalue\orvalue. |
| 595 |
The first macro returns the value of \paramatt if it exists, or |
| 596 |
does nothing otherwise. Like all the \verb/-or/ and \verb/-and/ |
| 597 |
variants below, \com\usevalueor executes \orvalue in case |
| 598 |
\paramatt doesn't exist, while \com\usevalueand returns |
| 599 |
the value of \paramatt immediately followed by \andvalue |
| 600 |
(no brace added) if \paramatt exists, otherwise it executes |
| 601 |
\orvalue. |
| 602 |
|
| 603 |
\Example |
| 604 |
Zappa's job was \usevalueand Zappa : job |
| 605 |
{ (and then some!)} |
| 606 |
{unknown} |
| 607 |
and he played the \usevalueor Zappa : instrument |
| 608 |
{guitar}. |
| 609 |
\Example/ |
| 610 |
|
| 611 |
|
| 612 |
\iflines4{}{\breakpage} |
| 613 |
\describe*!\passvalue\codarg\paramatt. |
| 614 |
\describe!\passvalueor\codarg\paramatt\orvalue. |
| 615 |
\describe!\passvalueand\codarg\paramatt\andvalue\orvalue. |
| 616 |
These return \codarg\barg{value} if \paramatt is defined, |
| 617 |
with the \verb/-or/ and \verb/-and/ variants as above. |
| 618 |
|
| 619 |
\Example |
| 620 |
\def\whichwas#1{(which was #1)} |
| 621 |
Zappa's job \passvalue\whichwas Zappa : job \ took |
| 622 |
most of his time, because it's a time-consuming |
| 623 |
occupation \nometa\passvalueor\whichwas Zappa : job |
| 624 |
{(you know which)}. |
| 625 |
\Example/ |
| 626 |
|
| 627 |
\describe*!\passvaluenobraces\codarg\paramatt. |
| 628 |
\describe!\passvaluenobracesor\codarg\paramatt\orvalue. |
| 629 |
\describe!\passvaluenobracesand\codarg\paramatt\andvalue\orvalue. |
| 630 |
These are the same as \com\passvalue and variants except the |
| 631 |
value of the attribute is concatenated to \codarg without braces |
| 632 |
(which means that no braces are added in the process, not that |
| 633 |
braces are removed from the value if it has any). |
| 634 |
|
| 635 |
\describe*\settovalue\arg{dimen or count}\paramatt. |
| 636 |
\describe\settovalueor\arg{dimen or count}\paramatt\orvalue. |
| 637 |
\describe\settovalueand\arg{dimen or count}\paramatt\andvalue\orvalue. |
| 638 |
This sets the first argument to the value of \paramatt if it exists. |
| 639 |
If the first argument is more than one token (e.g. \verb/\count0/ |
| 640 |
vs. \verb/\parindent/), it must be surrounded by braces; and actually |
| 641 |
it can even be something like \verb/\advance\count0/. Of course |
| 642 |
\arg{dimen or count} must be a dimension or a count, and the value |
| 643 |
of \paramatt must be accordingly a dimension |
| 644 |
or a number (\yax doesn't check either of them). |
| 645 |
|
| 646 |
\Example |
| 647 |
\setparameter para : parskip = 2pt \par |
| 648 |
Note that |
| 649 |
\settovalueor\parskip para : parskip |
| 650 |
{\parskip=1pt\relax} |
| 651 |
(\the\parskip) is basically the same thing as |
| 652 |
\parskip=\usevalueor para : foo {1pt\relax} |
| 653 |
(\the\parskip). |
| 654 |
\Example/ |
| 655 |
|
| 656 |
What the previous example shows is that since \com\usevalue |
| 657 |
is thoroughly expandable one can say: |
| 658 |
|
| 659 |
\example |
| 660 |
\mydimen=\usevalueor parameter : attribute {0pt} |
| 661 |
\example/ |
| 662 |
|
| 663 |
\noindent and it will set \com\mydimen to the value |
| 664 |
of \paramatt or to \verb/0pt/. The difference with \com\settovalueor |
| 665 |
is that in the construction with \com\usevalueor the assignement |
| 666 |
is obligatorily made (hence the \verb/-or/ variant), whereas |
| 667 |
with \com\settovalueor the or-clause can do something else |
| 668 |
(e.g. send an error message). And \com\settovalue insert a |
| 669 |
prophylactic \com\relax. |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
\describe*\storevalue\comarg\paramatt. |
| 675 |
\describe\storevalueor\comarg\paramatt\orvalue. |
| 676 |
\describe\storevalueand\comarg\paramatt\andvalue\orvalue. |
| 677 |
These define \comarg as the value of \paramatt if it exists. |
| 678 |
|
| 679 |
\Example |
| 680 |
\setparameter Zappa : hairstyle = \moustache\par |
| 681 |
\storevalue\beard Zappa : hairstyle |
| 682 |
\meaning\beard |
| 683 |
\Example/ |
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
\describe*!\ifvalue\paramatt=\value\ \true\false. |
| 688 |
This returns \true if the value of \paramatt is \value |
| 689 |
and \false otherwise (including unexisting \paramatt). |
| 690 |
Note that when comparing the value of \paramatt with |
| 691 |
\value, catcodes aren't part of the picture. |
| 692 |
Here \value is delimited by the following space, but |
| 693 |
there might be optional space after the `\verb/=/' sign. |
| 694 |
Because of this, it is not possible to test for the |
| 695 |
emptyness of a value with \com\ifvalue, i.e. |
| 696 |
|
| 697 |
\example |
| 698 |
\ifvalue foo : bar = {} {true}{false} |
| 699 |
\example/ |
| 700 |
|
| 701 |
\noindent won't work. Instead, either use \com\ifcasevalue below or \com\passvalue |
| 702 |
with an emptyness-tester (e.g. \verb/texapi/'s |
| 703 |
\com\ifemptystring, since \yax is based on \verb/texapi/ |
| 704 |
(what, me, self-advertising?)). |
| 705 |
|
| 706 |
\Example |
| 707 |
\bgroup \catcode`\Z=13 |
| 708 |
\setparameter foo : g: bar = Z \par |
| 709 |
\egroup |
| 710 |
\edef\foobar{% |
| 711 |
\ifvalue foo : bar = Z {yes}{no}, |
| 712 |
even though catcodes are different.} |
| 713 |
\meaning\foobar |
| 714 |
\Example/ |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
\iflines2{}{\breakpage} |
| 719 |
\describe*!\ifcasevalue\paramatt. |
| 720 |
\describe\val\value\ \codarg. |
| 721 |
\describe\val\value\ \codarg. |
| 722 |
\verb/.../ \par\noindent |
| 723 |
\describe\elseval \codarg. |
| 724 |
\describe\endval\relax. |
| 725 |
This executes \codarg following \value matching |
| 726 |
the value of \paramatt. If \paramatt doesn't exist, or |
| 727 |
matches no \value, then \com\elseval is executed. Once again |
| 728 |
catcodes aren't taken into account when values are compared. |
| 729 |
The exact syntax is: \value is anything from \com\val to the |
| 730 |
next space, and \codarg is anything that follows up to the next |
| 731 |
\com\val, \com\elseval or \com\endval (any space on the right |
| 732 |
is removed, so no need to stick \com\val to \codarg). |
| 733 |
Apart from \com\endval, everything here is optional: there might |
| 734 |
be as many \com\val-clauses as needed, including none, and the |
| 735 |
\com\elseval-clause need not be present (in which case, if no |
| 736 |
match occurs, nothing happens). Finally, although this is |
| 737 |
similar to \TeX's primitive \com\ifcase, there's no need |
| 738 |
to jump before anything with \com\expandafter to avoid |
| 739 |
bumping into conditional structure. |
| 740 |
|
| 741 |
\Example |
| 742 |
\def\doitalic#1{{\it#1}} |
| 743 |
\setparameter type : font = italic \par |
| 744 |
\ifcasevalue type : font |
| 745 |
\val italic \doitalic |
| 746 |
\val bold \dobold |
| 747 |
\endval{Some text.} |
| 748 |
|
| 749 |
\edef\foo{% |
| 750 |
\ifcasevalue type : font |
| 751 |
\val bold This is bold |
| 752 |
\elseval This is something else |
| 753 |
\endval} |
| 754 |
\meaning\foo |
| 755 |
\Example/ |
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
\describe*!\parameterloop\paralist:\arg{code}. |
| 760 |
This loops on all the attributes for all the parameters in \paralist, |
| 761 |
and passes the following thing to \arg{code}: the parameter, the attribute, |
| 762 |
and the value. Hence \arg{code} can be anything, but it should be prepared |
| 763 |
to handle three arguments. The order in which parameters are enumerated is the |
| 764 |
order in \paralist, and for attributes it is the order in which they were set |
| 765 |
for a given parameter. Only actual attributes are enumerated: if you loop over |
| 766 |
\verb"ParameterA", which doesn't have \verb"AttributeA" but has a \verb"meta" |
| 767 |
parameter with that attribute, then \verb"AttributeA" will \emph{not} be |
| 768 |
enumerated in the loop. |
| 769 |
|
| 770 |
\Example |
| 771 |
\setparameter musician : job = music\par |
| 772 |
\setparameter zappa : |
| 773 |
meta = musician |
| 774 |
instrument = guitar |
| 775 |
|
| 776 |
\def\showvalues#1#2#3{#1 : #2 = #3\par} |
| 777 |
\parameterloop musician zappa : \showvalues |
| 778 |
\Example/ |
| 779 |
|
| 780 |
|
| 781 |
\section{Using another syntax} |
| 782 |
|
| 783 |
\noindent If you don't like \yax's native syntax, and want for instance |
| 784 |
good old braces to delimit \param and \attr, you might be tempted |
| 785 |
to do something like: |
| 786 |
|
| 787 |
\example |
| 788 |
\def\myusevalue#1#2{\usevalue #1:#2 } |
| 789 |
\example/ |
| 790 |
|
| 791 |
\noindent On the other hand, if you don't mind \yax's syntax |
| 792 |
but want other names for the commands, then you'll probably go: |
| 793 |
|
| 794 |
\example |
| 795 |
\let\myusevalue\usevalue |
| 796 |
\example/ |
| 797 |
|
| 798 |
\noindent Both are bad ideas. Indeed, in neither example will |
| 799 |
\com\myusevalue work properly with \com\nometa. Besides, you |
| 800 |
have to create the \verb/-or/ and \verb/-and/ variants by hand. |
| 801 |
Not to mention that in the first example \com\myusevalue wastes |
| 802 |
time calling \com\usevalue (and what if it is redefined?) when |
| 803 |
it could be in direct relation with internal code. So here's how |
| 804 |
to circumvent \yax's syntax and/or create new names. |
| 805 |
|
| 806 |
\describe*\newsyntax\arg{syntax}\barg{prefix}. |
| 807 |
This creates commands whose names are \verb/\/\arg{prefix}\comarg |
| 808 |
and whose syntax for arguments is \arg{syntax}. The latter is |
| 809 |
a parameter text which must contain \verb/#1/ and \verb/#2/ (for |
| 810 |
\param and \attr respectively) with whatever to delimit them. |
| 811 |
For instance: |
| 812 |
|
| 813 |
\example |
| 814 |
\newsyntax#1#2{x} |
| 815 |
\newsyntax#1 #2!{y} |
| 816 |
\example/ |
| 817 |
|
| 818 |
\noindent will create among others an \com\xusevalue command whose usage is |
| 819 |
\com\xusevalue\param\attr and a \com\yusevalue command whose |
| 820 |
usage is \com\yusevalue\param\ \attr\tcode! and both will do the |
| 821 |
same thing as \com\usevalue. There must be braces around \arg{prefix} |
| 822 |
and none around \arg{syntax} (i.e. the latter is delimited by |
| 823 |
the left brace of the former). If \arg{prefix} is empty, |
| 824 |
you redefine the default commands, which is dangerous. |
| 825 |
|
| 826 |
To be precise, the commands copied are (omitting the \verb/-or/ |
| 827 |
and \verb/-and/ variants, which are created too, if any): |
| 828 |
\com\setattribute, \com\esetattribute, \com\gsetattribute, \com\xsetattribute, |
| 829 |
\com\ifattribute, \com\usevalue, \com\passvalue, \com\passvaluenobraces, |
| 830 |
\com\settovalue, \com\storevalue, \com\ifvalue, \com\ifcasevalue, |
| 831 |
\com\deleteattribute and \com\restrictattribute (which you'll learn |
| 832 |
about in the next section). |
| 833 |
|
| 834 |
\describe*\copysyntax\arg{prefix1}\arg{prefix2}. |
| 835 |
This defines all the commands above with \arg{prefix1} as |
| 836 |
those same commands with \arg{prefix2}. |
| 837 |
|
| 838 |
\describe*\letyaxcommand\arg{command1}\arg{command2}. |
| 839 |
This at the very least \com\let \arg{command1} to \arg{command2}. |
| 840 |
Besides, if \arg{command2} can take a \com\nometa prefix, |
| 841 |
\arg{command1} can too. Finally, if \arg{command2} has |
| 842 |
\verb/-or/ and \verb/-and/ variants, these are created with |
| 843 |
\arg{command1}. E.g.: |
| 844 |
|
| 845 |
\example |
| 846 |
\letyaxcommand\defval\storevalue |
| 847 |
\example/ |
| 848 |
|
| 849 |
\noindent defines \com\defval, \com\defvalor and \com\defvaland |
| 850 |
as \com\storevalue and its variants. If \arg{command2} has been |
| 851 |
created with \com\newsyntax or \com\copysyntax, \arg{command1} |
| 852 |
of course has the same syntax. |
| 853 |
|
| 854 |
|
| 855 |
\Example |
| 856 |
\newsyntax#1#2{x} |
| 857 |
\letyaxcommand\uv\xusevalue |
| 858 |
\uvand{noparameter}{noattribute}{yes}{no} |
| 859 |
\Example/ |
| 860 |
|
| 861 |
|
| 862 |
\section{Restrictions on parameters and attributes} |
| 863 |
|
| 864 |
|
| 865 |
\describe*\restrictparameter\paralist:\attrlist\tcode{\char`\\par}. |
| 866 |
After this declaration, the \param's in \paralist (where they are separated |
| 867 |
by space as in \com\setparameter) can take only those \attr's in |
| 868 |
\attrlist (which are also separated by space). It affects \com\setparameter |
| 869 |
only, producing an error message when an \attr not belonging to |
| 870 |
\attrlist is given a value (and the assignment isn't made, of course). |
| 871 |
Even if it doesn't belong to \attrlist, the \verb/meta/ attribute is |
| 872 |
always allowed. Several \com\restrictparameter declarations on the |
| 873 |
same parameter(s) actually accumulate the allowed attributes in \paralist, |
| 874 |
e.g. after |
| 875 |
|
| 876 |
\example |
| 877 |
\restrictparameter foo : one two three\par |
| 878 |
\restrictparameter foo : four\par |
| 879 |
\example/ |
| 880 |
|
| 881 |
\noindent one can set the attributes \verb/one/, \verb/two/, \verb/three/ |
| 882 |
and \verb/four/ for \verb/foo/, and not only \verb/four/. The idea behind |
| 883 |
\com\restrictparameter is not so much hiding attributes from the user |
| 884 |
as making the use of a parameter clearer by indicating which attributes |
| 885 |
are in use with it, especially if it can be executed (see below). |
| 886 |
|
| 887 |
\describe*\restrictattribute\paramatt\ \vallist\tcode{\char`\\par}. |
| 888 |
This restricts \paramatt to take only the values in \vallist (separated |
| 889 |
by space). |
| 890 |
|
| 891 |
\describe*\restrictallattributes\attr\ \vallist\tcode{\char`\\par}. |
| 892 |
This restricts \attr, whatever the \param in which it appears, to |
| 893 |
take only the values in \vallist. In this command, \attr is |
| 894 |
found as anything before the first space, e.g.: |
| 895 |
|
| 896 |
\example |
| 897 |
\restrictallattributes attribute value1 value2 value3\par |
| 898 |
\restrictallattributes {attri bute} value1 value2 value3\par |
| 899 |
\example/ |
| 900 |
|
| 901 |
\noindent (the second example if you want to have space in attribute |
| 902 |
names). Note that if an attribute is restricted with both |
| 903 |
\com\restrictattribute and \com\restrictallattributes, |
| 904 |
only the former restriction holds. E.g.: |
| 905 |
|
| 906 |
\example |
| 907 |
\restrictattribute foo:bar one\par |
| 908 |
\restrictallattributes bar two three\par |
| 909 |
\setparameter foo: |
| 910 |
bar = two % Will produce an error message. |
| 911 |
... |
| 912 |
\example/ |
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
\section{Defining parameters}[defpar] |
| 917 |
|
| 918 |
\describe*\defparameter\paralist\barg{definition}. |
| 919 |
Parameters aren't just a way of organizing attributes. They |
| 920 |
can have a definition and act as commands whose arguments |
| 921 |
are the values of their attributes. The \paralist (with |
| 922 |
parameters once again separated by space) must be |
| 923 |
braceless, whereas \arg{definition} must be enclosed in |
| 924 |
braces (like a real definition). No parameter text is |
| 925 |
allowed. However, \arg{definition} can contain `\verb/#1/', |
| 926 |
which doesn't refer to any argument but to the parameter |
| 927 |
being defined instead, so that one can use the commands |
| 928 |
defined in the previous section without specifying the name |
| 929 |
of the parameter. E.g. |
| 930 |
|
| 931 |
\example |
| 932 |
\defparameter foo bar {% |
| 933 |
\usevalue #1 : one |
| 934 |
\passvalueor\mycomm #1 : whatever {...}% |
| 935 |
...} |
| 936 |
\example/ |
| 937 |
|
| 938 |
\noindent defines \verb/foo/ and \verb/bar/ respectively |
| 939 |
to |
| 940 |
|
| 941 |
\example |
| 942 |
\usevalue foo : one |
| 943 |
\passvalueor\mycomm foo : whatever {...}% |
| 944 |
... |
| 945 |
\usevalue bar : one |
| 946 |
\passvalueor\mycomm bar : whatever {...}% |
| 947 |
... |
| 948 |
\example/ |
| 949 |
|
| 950 |
\describe*!\executeparameter\param:. |
| 951 |
This executes the definition of \param with the the latest values |
| 952 |
of its attributes. If \param hasn't been defined, nothing happens. |
| 953 |
|
| 954 |
\Example |
| 955 |
\defparameter foo {The value is \usevalue#1:bar } |
| 956 |
\setparameter foo : bar = whatever\par |
| 957 |
\executeparameter foo: |
| 958 |
\Example/ |
| 959 |
|
| 960 |
|
| 961 |
\describe*\defactiveparameter\paralist\barg{definition}. |
| 962 |
This does the same thing as \com\defparameter, i.e. define the |
| 963 |
parameters in \paralist, but it also set them as `active,' |
| 964 |
which means that they're automatically executed each time |
| 965 |
their attributes are defined with \com\setparameter. You |
| 966 |
can still use \com\executeparameter. |
| 967 |
|
| 968 |
\Example |
| 969 |
\setparameter metasection : skip = 2 font = \it\par |
| 970 |
\setparameter mysection : % not yet active |
| 971 |
meta = metasection\par |
| 972 |
\defactiveparameter mysection {% |
| 973 |
\vskip \usevalueor #1 : skip 0\baselineskip |
| 974 |
{\usevalue #1 : font \usevalue #1 : title }% |
| 975 |
\par} |
| 976 |
|
| 977 |
And now we're going to have a new section. |
| 978 |
\setparameter mysection : title = "A new section"\par |
| 979 |
Fascinating. Once again? |
| 980 |
\setparameter mysection : title = "Once again"\par |
| 981 |
Cool. |
| 982 |
\Example/ |
| 983 |
|
| 984 |
|
| 985 |
%{\it\noindent See next page for the last example.} |
| 986 |
|
| 987 |
|
| 988 |
\Example |
| 989 |
\setparameter metasection : |
| 990 |
skip = 2 |
| 991 |
inline = false |
| 992 |
font = \it |
| 993 |
|
| 994 |
\setparameter mysection mysubsection : |
| 995 |
meta = metasection |
| 996 |
|
| 997 |
\setparameter mysection : |
| 998 |
font = \sc |
| 999 |
|
| 1000 |
\setparameter mysubsection : |
| 1001 |
skip = 1 |
| 1002 |
inline = true |
| 1003 |
|
| 1004 |
\defparameter mysection mysubsection {% |
| 1005 |
\vskip \usevalueor #1 : skip 0\baselineskip |
| 1006 |
{\usevalue #1 : font \usevalue #1 : title }% |
| 1007 |
\ifvalue #1 : inline = true {. \ignorespaces}% |
| 1008 |
\par}% |
| 1009 |
|
| 1010 |
\def\section#1{% |
| 1011 |
\setparameter mysection : title = {#1}\par |
| 1012 |
\executeparameter mysection :} |
| 1013 |
|
| 1014 |
\def\subsection#1{% |
| 1015 |
\setparameter mysubsection : title = {#1}\par |
| 1016 |
\executeparameter mysubsection :} |
| 1017 |
|
| 1018 |
|
| 1019 |
... and this is the end of our paragraph. |
| 1020 |
\section{New ideas} |
| 1021 |
Here we are going to expose bold new ideas. |
| 1022 |
\subsection{First bold new idea} |
| 1023 |
Lore, aim, hip, sum... what do you think about |
| 1024 |
it? Pig latin, you say? |
| 1025 |
\subsection{Second bold new idea} |
| 1026 |
Perhaps Do lore, aim... then, huh? |
| 1027 |
\section{New new ideas} |
| 1028 |
Etc. |
| 1029 |
\Example/ |
| 1030 |
|
| 1031 |
\finishpdffile |
| 1032 |
\bye |