Changes

Jump to navigation Jump to search
132 bytes added ,  16:22, 11 November 2019
no edit summary
|attributes=
}}
 
== [[Help:Reference|Syntax]] (autogenerated) ==
<syntax>define</syntax>
== [[Help:Reference|Syntax]] ==
<tr valign="top" class="third">
<td class="cmd">{...}</td>
<td><i>text</i> ''macro contents''</td>
</tr>
</table>
== Description ==
<code>\define</code> is like the TeX primitive <code>\def</code>: it defines a new TeX macro.
 
=== define vs def ===
Unlike <code>\def</code>, it will '''not allow you to redefine''' an already defined command.
* In MkII, {{cmd|define}} is like the TeX primitive {{tex|def}}: it defines a new TeX macro. * In MkIV {{cmd|define}} is like {{tex|unexpanded}}{{tex|def}}: and \defineexpandable is like {{tex|def}}.The optional (bracketed) argument denotes the number of parameters you can give to your command. "text" ''macro contents'' is the result when the macro gets expanded.
== pitfalls Pitfalls ==<code>\define</code> does not use <code>\{{tex|long</code>, }}; that means that in MkIImultiple paragraphs (e.g. through <code>\{{tex|par</code> }} or <codett>\endgraf</codett>)
inside arguments will not work.
The name of the new command may not include numbers.
== Example ==
<context mode=mkiv source="yes">
% wiki mode=mkiv
== Example == <context 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/* {{tex|def http://en.wikibooks.org/wiki/TeX/def]}}
<!== Help from ConTeXt-- something like [[cmdMailinglist/Forum ==All issues with:goto{{Forum|\goto]] -->{{SUBPAGENAME}}}}
[[Category:CommandsCommand/Internals|define]]

Navigation menu