% LaTeX %nul %nul %nul %nul %nul %nul \documentclass[leqno]{article} \usepackage{url} \usepackage{graphicx} \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{bm} \usepackage{gellmu} \usepackage[margin=100bp,nohead]{geometry} \setlength{\parskip}{6bp} \setlength{\parindent}{0bp} \thispagestyle{empty} \title{The Use of \emph{newcommand} in GELLMU} \newlength{\centerskip} \setlength{\centerskip}{\topsep} \newcommand{\hsf}{\hspace*{\fill}} \newcommand{\tdbc}[1]{\hsf\textbf{#1}\hsf} \newenvironment{menulist}{ \begin{list}{}{ \setlength{\topsep}{0bp} \setlength{\labelwidth}{0.03\linewidth} \setlength{\leftmargin}{0.06\linewidth} \setlength{\itemindent}{0bp} \setlength{\itemsep}{-6bp} \setlength{\parsep}{6bp}} }{\end{list}} \newenvironment{Menulist}{ \begin{list}{}{ \setlength{\topsep}{0bp} \setlength{\labelwidth}{0.03\linewidth} \setlength{\leftmargin}{0.06\linewidth} \setlength{\itemindent}{0bp} \setlength{\itemsep}{3bp} \setlength{\parsep}{6bp}} }{\end{list}} \newenvironment{toclist}{\normalsize \begin{list}{}{ }}{\end{list}} \newenvironment{Toclist}{\large \begin{list}{}{ }}{\end{list}} \newenvironment{citations}{ \begin{list}{}{ \setlength{\topsep}{0bp} \setlength{\labelwidth}{0bp} \setlength{\leftmargin}{0.04\linewidth} \setlength{\labelsep}{0bp} \setlength{\itemindent}{-0.2\leftmargin} \setlength{\itemsep}{3bp} \setlength{\parsep}{0bp}} }{\end{list}} \begin{document} \begin{center}\LARGE\bfseries{} The Use of \emph{newcommand} in GELLMU \end{center} \medskip \section*{1\ \ \label{SU-1}Introduction} \par{In \textsc{GELLMU} the command \emph{newcommand} is a meta-command that is handled by macro-like pre-processing in the \textsc{GELLMU} syntactic translator. \ This pre-processing takes place very early after the processing of the required meta-command \emph{documenttype} and after the insertion of any (relatively rare) internal \textsc{SGML} declaration subset. \ } \section*{2\ \ \label{SU-2}First Examples} \par{The markup for the field \(\mbox{\textbf{Q}}\) of rational numbers is a \emph{newcommand} invocation \texttt{"}\verb+\+\texttt{Q"} without arguments that expands to \texttt{"}\verb+\+\texttt{regch}\verb+{+\texttt{}\verb+\+\texttt{bold}\verb+{+\texttt{Q}\verb+}+\texttt{}\verb+}+\texttt{"}.\footnote{The command \emph{regch} is an alternative form of \emph{mbox} in the didactic \textsc{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 \(\bar{\mbox{\textbf{Q}}}\)\@, which is written in the \textsc{GELLMU} source here with \texttt{\textbackslash{}ovbar\{\textbackslash{}Q\}}. \ } Newcommand names are case-sensitive. \ Here the newcommand invocation \texttt{"}\verb+\+\texttt{q"} expands to \texttt{"}\verb+\+\texttt{regch}\verb+{+\texttt{}\verb+\+\texttt{slnt}\verb+{+\texttt{Q}\verb+}+\texttt{}\verb+}+\texttt{"}, which yields the ad-hoc math symbol \(\mbox{\textsl{Q}}\)\@. \ } \par{Markup to represent the general linear group may be a \emph{newcommand} with definition \begin{center} \verb+\newcommand{\gl}[2][2]{\mbox{GL}_{#1}(#2)}+ . \ \end{center} When invoked with \texttt{"}\verb+\+\texttt{gl}\verb+{+\texttt{3}\verb+}+\texttt{}\verb+{+\texttt{F}\verb+}+\texttt{"}, it yields \(\mbox{GL}_{3}(F)\)\@. \ } \par{Mention of the group \(\mbox{GL}_{2}(F)\) is obtained alternatively here with the minimized markup invocation \texttt{"}\verb+\+\texttt{gl}\verb+{+\texttt{F}\verb+}+\texttt{"} relying on the default value of the first argument given in the definition of \texttt{"}\verb+\+\texttt{gl"}. \ } \section*{3\ \ \label{SU-3}Some Details} \par{With the \emph{newcommand} definition \begin{center} \verb+\newcommand{\Q}{\regch{\bold{Q}}}+ \end{center} the markup \verb+\Q;+ may always be used instead of \verb+\Q+ and must be used if the \(\mbox{\textbf{Q}}\) is followed immediately by characters that could have the effect of making the \texttt{`Q'} in the markup look simply like the first character in a larger string. \ However, the markup \verb+\Q;{}+ is incorrect unless \emph{regch} is a command that takes two arguments. \ For it expands to \begin{center} \verb+\regch{\bold{Q}}{}+ . \ \end{center} } \subsection*{3.1\ \ \label{SU-3.1}What Markup Can Follow a \emph{newcommand}? \ } \par{What characters can safely follow the name of a \emph{newcommand}? \ Of course, a following \texttt{`}\verb+{+\texttt{'} can only mean the beginning of an argument to the command. \ On the other hand the \texttt{`}\verb+{+\texttt{'} can be escaped. \ } \par{Some examples: \begin{center} \begin{tabular}{ll} {}\textbf{Markup}~~~~ & \textbf{Yield} \\ {}\verb+$\Q$+ & \(\mbox{\textbf{Q}}\) \\ {}\verb+$\Q;xy$+ & \(\mbox{\textbf{Q}}xy\) \\ {}\verb+$\Q;$xy+ & \(\mbox{\textbf{Q}}\)xy \\ {}\verb+$\Q;;$+ & \(\mbox{\textbf{Q}};\) \\ {}\verb+$\Q;$;+ & \(\mbox{\textbf{Q}}\); \\ {}\verb+$\Q\bsl;$+ & \(\mbox{\textbf{Q}}\backslash{}\) \\ {}\verb+$\Q\{$+ & \(\mbox{\textbf{Q}}\{\) \\ {}\verb+$\Q\}$+ & \(\mbox{\textbf{Q}}\}\) \\ {}\verb+$\Q\lsb;$+ & \(\mbox{\textbf{Q}}[\) \\ {}\verb+$\Q\rsb;$+ & \(\mbox{\textbf{Q}}]\) \\ {}\verb+$\Q!$+ & \(\mbox{\textbf{Q}}!\) \\ {}\verb+$\Q@$+ & \(\mbox{\textbf{Q}}@\) \\ {}\verb+$\Q\#$+ & \(\mbox{\textbf{Q}}\#\) \\ {}\verb+$\Q\%$+ & \(\mbox{\textbf{Q}}\%\) \\ {}\verb+$\Q^5$+ & \(\mbox{\textbf{Q}}^{5}\) \\ {}\verb+$\Q_p$+ & \(\mbox{\textbf{Q}}_{p}\) \\ {}\verb+$\Q\und;$+ & \(\mbox{\textbf{Q}}\_\) \\ {}\verb+$\Q\crt;$+ & \(\mbox{\textbf{Q}}\wedge\) \\ {}\verb+$\Q*$+ & \(\mbox{\textbf{Q}}*\) \\ {}\verb+$\Q-$+ & \(\mbox{\textbf{Q}}-\) \\ {}\verb+$\Q(t)$+ & \(\mbox{\textbf{Q}}(t)\) \\ {}\verb+$\Q+\verb-+-\verb+$+ & \(\mbox{\textbf{Q}}+\) \\ {}\verb+$\Q=$+ & \(\mbox{\textbf{Q}}\, = \,\) \\ {}\verb+$\Q$+= & \(\mbox{\textbf{Q}}\)= \\ {}\verb+$\Q,$+ & \(\mbox{\textbf{Q}},\) \\ {}\verb+$\Q.$+ & \(\mbox{\textbf{Q}}.\) \\ {}\verb+$\Q?$+ & \(\mbox{\textbf{Q}}?\) \end{tabular} \end{center} } \subsection*{3.2\ \ \label{SU-3.2}Comments in newcommand definitions} \par{It is useful here to comment on \textsc{GELLMU}, which is a bridge from \LaTeX{} to \textsc{SGML}, as it compares to \LaTeX{}. \ \LaTeX{} usage of \emph{newcommand} sometimes takes the form %nul %nul %nul %nul \begin{center} \begin{tabular}{l} {}\verb+\newcommand{\foo}[2]{%+ \\ {}\verb+This is an instance of the \emph{newcommand} ``foo'' %+ \\ {}\verb+with first argument `#1' and% Space following a newline is swallowed+ \\ {}\verb+ second argument `#2'.}+ \end{tabular} \end{center} } \par{This usage is useful in that it gives the author a way, especially with empty comments, to make the source document more readable. \ } \par{With \textsc{GELLMU} as a general matter such use of comments in regular command arguments may have side effects if the author is not careful. \ Because \emph{newcommand} is a meta-command handled by the \textsc{GELLMU} syntactic translator, this use of comments will not have side effects. \ } \par{Since \emph{newcommand} in \textsc{GELLMU} is a meta-command, it is \textbf{not} necessary to restrict an instance of \emph{newcommand} to a document preamble. \ However, any invocation of a command defined with \emph{newcommand} must be preceded by the definition. \ } \par{The definition of \texttt{}\verb+\+\texttt{foo} appears in this document just before the display of its definition, and the next sentence is the invocation \texttt{"}\verb+\+\texttt{foo}\verb+{+\texttt{cat}\verb+}+\texttt{}\verb+{+\texttt{dog}\verb+}+\texttt{"}. \ This is an instance of the \emph{newcommand} ``foo'' with first argument `cat' andsecond argument `dog'. \ } \par{Note that the comment ``Space following \ldots{}'' on the second line of the value string absorbs the space at the beginning of the third line with the result that the words \emph{and} and \emph{second} are run together. \ This phenomenon mimics \LaTeX{}; however, such comment ``overrun'' is the behavior of the \textsc{GELLMU} syntactic translator only inside a \emph{newcommand} value string. \ In all other contexts there is no comment overrun in \textsc{GELLMU}, and space at the beginning of a line following a comment is significant. \ } \subsection*{3.3\ \ \label{SU-3.3}Newlines in newcommand definitions} \par{It is important to note, however, that \emph{anything} inside the value argument of a \emph{newcommand} definition is propogated by the \textsc{GELLMU} syntactic translator to every invocation. \ With basic \textsc{GELLMU} newlines inside a newcommand value string are removed since \textsc{SGML} does not acknowledge a newline as a special form of white space and since newlines in a value string, when propogated to all invocations cause extra lines in the \textsc{GELLMU} syntactic translator output, thereby blocking the goal of line number alignment between \textsc{GELLMU} source and the \textsc{SGML} output, which is important for the interpretation of \textsc{SGML} parser error messages. \ } \par{In regular \textsc{GELLMU}, newlines can be significant. \ For this reason newlines in newcommand definitions are not removed. \ However, the use of newlines inside value strings is deprecated since they break line number alignment between the \textsc{GELLMU} source and the output of the \textsc{GELLMU} syntactic translator. \ There are other ways to achieve the effect of a newline inside a newcommand value string. \ } \end{document}