ConTEXt an excursion - Pragma ADE

ConTEXt an excursion - Pragma ADE ConTEXt an excursion - Pragma ADE

pragma.ade.nl
from pragma.ade.nl More from this publisher
29.05.2014 Views

Defining commands / macros Without any further explanation this command is used in the following example. You may have a well illustrated document and you are tired of typing: \placefigure [here,force] [fig:logical name] {Caption.} {\externalfigure[filename][width=5cm]} You could define your own command with a few variables like: contents index commands definitions colofon • logical name • caption • file name Your command definition and call could look something like this: \define[3]\myputfigure {\placefigure [here,force][fig:#1] {#2}{\externalfigure[#3][width=5cm]}} \myputfigure{lion}{The Dutch lion is a sentry.}{hass13g} Between brackets [3] indicates that you want to use three variables #1, #2 and #3. In the command call \myputfigure you have to input these variables between curly braces. The result would be: Very sophisticated commands can be programmed but this is left to your own inventiveness. In addition to defining commands you can also define \start · · · \stop command pairs. \definestartstop[...][..,..=..,..] exit search + go back For example: – + 36 106

Defining commands / macros contents index commands definitions colofon Figure 36.1 The Dutch lion is a sentry. \definestartstop [stars] [commands={\inleft{\hbox to \leftmarginwidth {\leaders\hbox{$\star$}\hfill}}}, before=\blank, after=\blank] ⋆⋆⋆⋆⋆⋆⋆ \startstars {\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}. \stopstars This will result in: Hasselter Juffers are sweet cookies but the name is no coincidence. On July 21 in 1233 the exit search + go back – + 36 107

Defining comm<strong>an</strong>ds / macros<br />

contents<br />

index<br />

comm<strong>an</strong>ds<br />

definitions<br />

colofon<br />

Figure 36.1<br />

The Dutch lion is a sentry.<br />

\definestartstop<br />

[stars]<br />

[comm<strong>an</strong>ds={\inleft{\hbox to \leftmarginwidth<br />

{\leaders\hbox{$\star$}\hfill}}},<br />

before=\bl<strong>an</strong>k,<br />

after=\bl<strong>an</strong>k]<br />

⋆⋆⋆⋆⋆⋆⋆<br />

\startstars<br />

{\em Hasselter Juffers} are sweet cookies but the name is no<br />

coincidence. On July 21 in 1233 the {\em Zwartewaterklooster}<br />

(Blackwater Monastery) was founded. The monastery was me<strong>an</strong>t<br />

for unmarried girls <strong>an</strong>d women belonging to the nobility of<br />

Hasselt. These girls <strong>an</strong>d women were called {\em juffers}.<br />

\stopstars<br />

This will result in:<br />

Hasselter Juffers are sweet cookies but the name is no coincidence. On July 21 in 1233 the<br />

exit<br />

search +<br />

go back<br />

– +<br />

36 107

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!