INTRODUCTION Often used commands or text can be abbreviated to make life easier for the writer. For example, in writing a LaTeX ducument, one might often use the *\LaTeX* command, which can be bothersome to write with it's combination of capital and lowercase letters. To help with this problem, LaTeX provides a command called *\newcommand*. Although the *\newcommand* does not have to be in the preamble, it is strongly suggested that the preamble is where you put such command definitions. This provides ease of editing and keeps from making you search through your file to find the command definition. COMMAND FORMAT The *\newcommand* command takes two arguments, the first is the name of the new command you want to define, and the second is what your command would expand into. For example, to replace \LaTeX with \LATEX one would put: \newcommand{\LATEX}{\LaTeX} then to use the \LaTeX command, you would only have to type \LATEX. A note on use: When you use these new commands you may have to add an additional \ after the command. This actually is nothing new, it holds for all of LaTeX's other commands, however, it is perhaps most commonly forgotten when making such macros. The reason is that if you use the \LATEX command in running tex such as: \LATEX is wonderful! it would appear as: LaTeXis wonderful. The space after \LATEX tells LaTeX that it is at the end of a command. It does not signal that a space should be added. Thus the correct line should be: \LATEX\ is wonderful! Now the line is correct in all aspects! COMMAND ARGUMENTS and SCOPING *\newcommand* is more powerful than just a straight macro definition, however. It can take parameters to which you can refer as you use your new command. each arguement of the your new command is referenced as *#1* for the first arguement, *#2* for the second, and so on. For example: \newcommand{\supsub}[3]{{#1}\mbox{$^{#2}_{#3}$}} would create a supscript subsript pair command of three arguments. The result of: \supsub{A}{1}{2} would be: 1 A 2 Let us dissect this command definition: the first argument of *\newcommand* is *{\supsub}* making a new command called *\supsub* The next argument is in brackets [] instead of braces {} and it signifies how many arguments the *\supsub* command should receive (in our example, 3) The final argument: {{#1}\mbox{$^{#2}_{#3}$}} has the #1 in braces to limit it's scope. Remember that LaTeX does a substitution of *\supsub* with this final argument (with the #1...#3 arguments repalced as well). If #1 were *not* enclosed with braces, \supsub{\em A}{1}{2} the remaining text would get expanded to: \em A\mbox{$^{1}_{2}$} giving 1 *A the remaining text* 2 as the result. "the remaining text" would also be italicized because the scope of \em isn't defined. Thus the braces around #1 solves the problem, and the command would be expanded to: {\em A}\mbox{$^{1}_{2}$} resulting in: 1 *A* the remaining text 2 Next, notice the *\mbox* command surrounding the $^{#1}_{#2}$ The reason for this is perhaps subtle. Imagine what would happen if the *\supsub* command were to be used while in math mode. If it were not for the *\mbox* command, the first $ would cause LaTeX to *leave* math mode, and consequently cause an error since ^ and _ are commands only for math mode. Clearly not what we want. RENEWCOMMAND If a command is already defined and you would like to change it, *\newcommand* is not the proper command to use, but rather, you should use the *\renewcommand* command. The format for *\renewcommand* is identical to that of *\newcommand* NESTING You may next one new command in other, however, you may not call a new command within it's own definition. The order of definition does not matter to Latex. Thus you may do: \newcommand{\firstnew}{\secondnew} \newcommand{\secondnew}{Be excellent to each other!}