\begin{page}{HTXAdvPage3}{Macros} \centerline{\fbox{{\tt \thispage}}}\newline \begin{scroll} Sometimes you may find yourself having to write almost the same piece of \HyperName{} text many times. Thankfully, there is a command to ease the work. It is the {\tt \\newcommand} command and provides a macro facility for \HyperName{}. In this way, you can give a short name to a sequence of \HyperName{} text and use that name to include the sequence in your pages. The way this works is the following \beginImportant \newline \centerline{{\tt \\newcommand\{\\{\it name}\}[{\it number of arguments}]\{{\it \HyperName{} text}\}}} \endImportant and here is an example from {\bf util.ht} \beginImportant \newline {\tt \\newcommand\{\\axiomSig\}[2]\{\\axiomType\{\#1\} \{\\tt ->\} \\axiomType\{\#2\}\}} \newline {\tt \\newcommand\{\\axiomType\}[1]\{\\lispdownlink\{\#1\}\{(|spadType| '|\#1|)\}\}} \endImportant You see that a macro's definition can invoke another. Don't create a circular definition though! Notice how the arguments of the macro are used in the definition. The {\tt \#{\it n}} construct is the place--holder of the {\it n}'th argument. To use the macro, just treat it as an ordinary command. For instance \beginImportant \newline {\tt \\axiomSig\{Integer\}\{List Integer\}} \endImportant displays and acts like this \beginImportant \newline \axiomSig{Integer}{List Integer} \endImportant The best way to familiarise yourself to macros is to study the macros defined in \centerline{ {\bf \env{AXIOM}/doc/hypertex/pages/util.ht} } It is highly probable that a good many of them will prove useful to you. Clever use of macros will allow you to create \HyperName{} text that can be formatted by other programs (such as TeX). The \Language{} User Guide was written in such a way as to make translation in \HyperName{} form and TeX form a mechanical process. \end{scroll} \beginmenu \menulink{Next Page --- Patch and Paste}{HTXAdvPage4} \endmenu \end{page}