Changes

Jump to navigation Jump to search
592 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 ==
<pre>
\define is like the TeX primitive \def: it defines a new TeX macro. Unlike
\def, 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. \define isnot \long, that means you cannot use \par inside the arguments.
</pre>== comment Pitfalls ==<precode>is there any bonus when I use \define instead of </code> does not use {{tex|long}}; that means that in MkIImultiple paragraphs (e.g. through {{tex|par}} or <tt>\def? -PGendgraf</prett>)inside arguments will not work.
The name of the new command may not include numbers.
== Example ==
<context mode=mkiv source= Example ="yes">% wiki mode=mkiv \define\hello{Good morning} % 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}
<pre class="% You can use non-ASCII characters in MkIV, but not in MkII.% This example">is compiled using mkiv.\define[1]\helloKüFst{Good morningKüstenfunkstelle, #1!}
\starttext
\hello \KüFst{mom12} % Good morning mom 
\stoptext
</precontext>
== See also ==
* {{tex|def}}
== See also Help from ConTeXt-Mailinglist/Forum ==<!-- something like [[cmdAll issues with:goto{{Forum|\goto]] -->{{SUBPAGENAME}}}}
[[Category:ReferenceCommand/enInternals|define]]

Navigation menu