Changes

Jump to navigation Jump to search
456 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. 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 ==<code>\define</code> is does not use <code>\{{tex|long</code>, }}; that means you cannot use that in MkIImultiple paragraphs (e.g. through {{tex|par}} or <codett>\parendgraf</codett> )inside the argumentswill not work.
The name of the new command may not include numbers. == comment Example ==<pre>is there any bonus when I use \define instead of \def? -PG</pre>
<context mode=mkiv source="yes">
% wiki mode=mkiv
\define\hello{Good morning}
== Example ==% 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}
<context source="yes">% 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
\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:ReferenceCommand/enInternals|define]]

Navigation menu