The GELLMU ArchiveThe Use of <emph >newcommand</emph > in <abbr >GELLMU</abbr >
1IntroductionIn GELLMU the command newcommand is a metacommand that is handled by macrolike preprocessing in the GELLMU syntactic translator This preprocessing takes place very early after the processing of the required metacommand documenttype and after the insertion of any (relatively rare) internal SGML declaration subset
2First ExamplesThe markup for the field Q of rational numbers is a newcommand invocation Q without arguments that expands to regchboldQ.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 Q which is written in the GELLMU source here with ovbarQ Newcommand names are casesensitive Here the newcommand invocation q expands to regchslntQ, which yields the adhoc math symbol QMarkup to represent the general linear group may be a newcommand with definition newcommandgl[2][2]mboxGL1(2) When invoked with gl3F, it yields GL3FMention of the group GL2F is obtained alternatively here with the minimized markup invocation glF relying on the default value of the first argument given in the definition of gl
3Some DetailsWith the newcommand definition newcommandQregchboldQ the markup Q; may always be used instead of Q and must be used if the 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 regchboldQ 3.1What Markup Can Follow a newcommandWhat 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 escapedSome examples: llMarkupYieldQQQ;xyQxyQ;xyQxyQ;;Q;Q;;Q;Qbsl;QQQQQQlsb;QQrsb;QQQQQQQQQQ5Q5QpQpQund;QQcrt;QQQQQQ(t)QtQQQQQQQ,Q,Q.Q.Q?Q? 3.2Comments in newcommand definitionsIt is useful here to comment on GELLMU, which is a bridge from to SGML, as it compares to usage of newcommand sometimes takes the form lnewcommandfoo[2]This is an instance of the emphnewcommand foo with first argument `1' and Space following a newline is swallowedsecond argument `2'.This usage is useful in that it gives the author a way, especially with empty comments, to make the source document more readableWith 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 metacommand handled by the GELLMU syntactic translator, this use of comments will not have side effectsSince newcommand in GELLMU is a metacommand, it is not necessary to restrict an instance of newcommand to a document preamble However, any invocation of a command defined with newcommand must be preceded by the definitionThe definition of foo appears in this document just before the display of its definition, and the next sentence is the invocation foocatdog 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 ; 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.3Newlines in newcommand definitionsIt is important to note, however, that anything inside the value argument of a newcommand definition is propogated by the GELLMU syntactic translator to every invocation With basic GELLMU newlines inside a newcommand value string are removed since 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 GELLMU syntactic translator output, thereby blocking the goal of line number alignment between GELLMU source and the SGML output, which is important for the interpretation of SGML parser error messagesIn regular 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 GELLMU source and the output of the GELLMU syntactic translator There are other ways to achieve the effect of a newline inside a newcommand value string