Changes

Jump to navigation Jump to search
7 bytes removed ,  10:37, 22 May 2012
m
Add category; improve example
== Description ==
<code>\define</code> is like the TeX primitive <code>\def</code>: it defines a new TeX macro. Unlike <code>\def</code>, '''<code>\define</code> can never redefine''' an already defined command.
=== define vs def ===Unlike <code>\def</code>, it will '''not allow you to redefine''' an already defined command. The optional (bracketed) argument denotes the number of parameters you can give
to your command. "text" is the result when the macro gets expanded.
== pitfalls Pitfalls ==<code>\define</code> does not use <code>\{{cmd|long</code>}}, that means in MkIImultiple paragraphs (e.g. through <code>\{{cmd|par</code> }} or <code>\{{cmd|endgraf</code>}})
inside arguments will not work.
The name of the new command may not include numbers.
 
 
== Example ==
<context mode=mkiv source="yes">\define[1]\hello{Good morning, #1!}
% You may not use numbers
% \define[1]\mp3{The ID3 Tag of the MP3 file is, : #1!}
% but this will work:
\define[1]\mpThree{The ID3 Tag of the MP3 file is, : #1!}
% You may not can use umlauts non-ASCII characters in mkiiMkIV, but not in MkII.% This example is compiled using mkiv .% \define[1]\KüFst{Küstenfunkstelle, #1!}
\starttext
\hello \KüFst{mom12
\stoptext
</context>
== See also ==
[http://en.wikibooks.org/wiki/TeX/def http://en.wikibooks.org/wiki/TeX/def]
<!-- something like {{cmd|goto}} -->* [http://en.wikibooks.org/wiki/TeX/def http://en.wikibooks.org/wiki/TeX/def]
== Help from ConTeXt-Mailinglist/Forum ==
{{Forum|{{SUBPAGENAME}}}}
[[Category:CommandsCommand/Internals|define]]

Navigation menu