blob: df0d2a2931544c1b3f1c44eb2a70f9043d8d3ba1 (
plain)
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
91
92
93
94
|
\startcomponent ma-cb-en-commands
\enablemode[**en-us]
\project ma-cb
\startchapter[title=Defining commands / macros]
\CONTEXT\ is a set of macros based on \TEX. \TEX\ is a programming language as
well as a typographical system. This means that you can do the programming
yourself if you need that kind of flexability.
You can define a new command with:
\shortsetup{define}
The next example will explain its meaning.
You may have a well illustrated document and you are tired of typing:
\startbuffer
\placefigure
[here,force]
[fig:logical name]
{Caption.}
{\externalfigure[filename][width=5cm]}
\stopbuffer
\typebuffer
You could define your own command with a few variables like:
\startitemize[packed]
\item logical name
\item caption
\item file name
\stopitemize
Your command definition and call could look something like
this:
\startbuffer
\define[3]\myputfigure
{\placefigure
[here,force][fig:#1]
{#2}{\externalfigure[#3][width=5cm]}}
\myputfigure{lion}{The Dutch lion is a sentry.}{ma-cb-13}
\stopbuffer
\typebuffer
From then on the \type{\myputfigure} is available.
Between brackets \type{[3]} indicates that you want to use three variables
\type{#1}, \type{#2} and \type{#3}. In the command call \type{\myputfigure} you
have to place these variables between curly braces. The result is shown in
\in{figure}[fig:lion].
\getbuffer
Very sophisticated commands can be programmed, but this is left to your own
inventiveness.
In addition to defining commands you can also define \type{\start...\stop}
command pairs.
\shortsetup{definestartstop}
For example:
\startbuffer
\definestartstop
[attention]
[before=\blank\startmarginrule,
after=\stopmarginrule\blank]
\startattention
{\em Hasselter Juffers} are sweet cookies but the name is no
coincidence. On July 21 in 1233 the {\em Zwartewaterklooster}
(Blackwater Monastery) was founded. The monastery was meant
for unmarried girls and women belonging to the nobility of
Hasselt. These girls and women were called {\em juffers}.
\stopattention
\stopbuffer
\typebuffer
This will result in:
\getbuffer
\stopchapter
\stopcomponent
|