Difference between revisions of "Command/define"

From Wiki
Jump to navigation Jump to search
m (Text replace - "ConTeXt-Forum " to "Help from ConTeXt-Forum ")
m (Text replace - "== Help from ConTeXt-Forum ==" to "== Help from ConTeXt-Forum == All issues with:")
Line 62: Line 62:
  
 
== Help from ConTeXt-Forum ==
 
== Help from ConTeXt-Forum ==
 +
All issues with:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
 
[[Category:Commands|define]]
 
[[Category:Commands|define]]

Revision as of 14:37, 16 March 2012

\define

Syntax

\define[...]\command{...}
[...] number
{...} text


Description

\define is like the TeX primitive \def: it defines a new TeX macro.

define vs def

Unlike \def, 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

\define does not use \long, that means in MkII multiple paragraphs (e.g. through \par or \endgraf) inside arguments will not work.

The name of the new command may not include numbers.


Example

\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 use umlauts in mkii, but in mkiv 
% \define[1]\KüFst{Küstenfunkstelle, #1!}

\starttext
\hello{mom}
\stoptext

See also

http://en.wikibooks.org/wiki/TeX/def


Help from ConTeXt-Forum

All issues with: