29.05.2014 Views

ConTEXt an excursion - Pragma ADE

ConTEXt an excursion - Pragma ADE

ConTEXt an excursion - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Without <strong>an</strong>y further expl<strong>an</strong>ation this comm<strong>an</strong>d is used in the following example.<br />

You may have a well illustrated document <strong>an</strong>d you are tired of typing:<br />

\placefigure<br />

[here,force]<br />

[fig:logical name]<br />

{Caption.}<br />

{\externalfigure[filename][width=5cm]}<br />

You could define your own comm<strong>an</strong>d with a few variables like:<br />

contents<br />

index<br />

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

definitions<br />

colofon<br />

• logical name<br />

• caption<br />

• file name<br />

Your comm<strong>an</strong>d definition <strong>an</strong>d call could look something like this:<br />

\define[3]\myputfigure<br />

{\placefigure<br />

[here,force][fig:#1]<br />

{#2}{\externalfigure[#3][width=5cm]}}<br />

\myputfigure{lion}{The Dutch lion is a sentry.}{hass13g}<br />

Between brackets [3] indicates that you w<strong>an</strong>t to use three variables #1, #2 <strong>an</strong>d #3. In<br />

the comm<strong>an</strong>d call \myputfigure you have to input these variables between curly braces.<br />

The result would be:<br />

Very sophisticated comm<strong>an</strong>ds c<strong>an</strong> be programmed but this is left to your own inventiveness.<br />

In addition to defining comm<strong>an</strong>ds you c<strong>an</strong> also define \start · · · \stop comm<strong>an</strong>d pairs.<br />

\definestartstop[...][..,..=..,..]<br />

exit<br />

search +<br />

go back<br />

For example:<br />

– +<br />

36 106

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

Saved successfully!

Ooh no, something went wrong!