# The Use of newcommand in GELLMU

### 1.  Introduction

In GELLMU the command newcommand is a meta-command that is handled by macro-like pre-processing in the GELLMU syntactic translator. This pre-processing takes place very early after the processing of the required meta-command documenttype and after the insertion of any (relatively rare) internal SGML declaration subset.

### 2.  First Examples


Markup to represent the general linear group may be a newcommand with definition

 \newcommand{\gl}[2][2]{\mbox{GL}_{#1}(#2)} .

When invoked with “\gl{3}{F}”, it yields ${\mathrm{GL}}_{3}\left(F\right)$.

Mention of the group ${\mathrm{GL}}_{2}\left(F\right)$ is obtained alternatively here with the minimized markup invocation “\gl{F}” relying on the default value of the first argument given in the definition of “\gl”.

### 3.  Some Details

With the newcommand definition

 \newcommand{\Q}{\regch{\bold{Q}}}

the markup \Q; may always be used instead of \Q and must be used if the $\mathbf{Q}$ is followed immediately by characters that could have the effect of making the ‘Q’ in the markup look simply like the first character in a larger string. However, the markup \Q;{} is incorrect unless regch is a command that takes two arguments. For it expands to

 \regch{\bold{Q}}{} .

#### 3.1.  What Markup Can Follow a newcommand?

What characters can safely follow the name of a newcommand? Of course, a following ‘{’ can only mean the beginning of an argument to the command. On the other hand the ‘{’ can be escaped.

Some examples:

 Markup Yield $\Q$ $\mathbf{Q}$ $\Q;xy$ $\mathbf{Q}xy$ $\Q;$xy $\mathbf{Q}$xy $\Q;;$ $\mathbf{Q};$ $\Q;$; $\mathbf{Q}$; $\Q\bsl;$ $\mathbf{Q}\$ $\Q\{$ $\mathbf{Q}\left\{$ $\Q\}$ $\mathbf{Q}\right\}$ $\Q\lsb;$ $\mathbf{Q}\left[$ $\Q\rsb;$ $\mathbf{Q}\right]$ $\Q!$ $\mathbf{Q}!$ $\Q@$ $\mathbf{Q}@$ $\Q\#$ $\mathbf{Q}#$ $\Q\%$ $\mathbf{Q}%$ $\Q^5$ ${\mathbf{Q}}^{5}$ $\Q_p$ ${\mathbf{Q}}_{p}$ $\Q\und;$ $\mathbf{Q}_$ $\Q\crt;$ $\mathbf{Q}^$ $\Q*$ $\mathbf{Q}*$ $\Q-$ $\mathbf{Q}-$ $\Q(t)$ $\mathbf{Q}\left(t\right)$ $\Q+$ $\mathbf{Q}+$ $\Q=$ $\mathbf{Q}=$ $\Q$= $\mathbf{Q}$= $\Q,$ $\mathbf{Q},$ $\Q.$ $\mathbf{Q}.$ $\Q?$ $\mathbf{Q}?$

#### 3.2.  Comments in newcommand definitions

It is useful here to comment on GELLMU, which is a bridge from LaTeX to SGML, as it compares to LaTeX. LaTeX usage of newcommand sometimes takes the form


This usage is useful in that it gives the author a way, especially with empty comments, to make the source document more readable.

With GELLMU as a general matter such use of comments in regular command arguments may have side effects if the author is not careful. Because newcommand is a meta-command handled by the GELLMU syntactic translator, this use of comments will not have side effects.


The definition of \foo appears in this document just before the display of its definition, and the next sentence is the invocation “\foo{cat}{dog}”. This is an instance of the newcommand ‘‘foo’’ with first argument cat' andsecond argument dog'.

Note that the comment “Space following …” on the second line of the value string absorbs the space at the beginning of the third line with the result that the words and and second are run together. This phenomenon mimics LaTeX; however, such comment “overrun” is the behavior of the GELLMU syntactic translator only inside a newcommand value string. In all other contexts there is no comment overrun in GELLMU, and space at the beginning of a line following a comment is significant.

#### 3.3.  Newlines in newcommand definitions



### Footnotes

1. * The command regch is an alternative form of mbox in the didactic GELLMU document type definition that differs from the latter in that it is permitted as the content of an “accent” tag as in the example $\overline{\mathbf{Q}}$, which is written in the GELLMU source here with \ovbar{\Q}.