# Textual substitution of macros in a LaTeX file

This is a question I am asking due to my personal experience in writing articles: I define commands (parametrized or not) to save time and reduce typos in formulas all around the paper. A very simple example I use very often is the following one:

\documentclass{article}
\usepackage{amsmath}
...
\newcommand{\CC}[1][n]{\mathbb{C}^{#1}}


However, some publishers do not want to process a .tex file containing custom defined commands, and require the author to write down every formula by using only standard LaTeX commands, and this give rise to my question: since commands are basically macros, is it possible to instruct the LaTeX preprocessor in order to produce a .tex file where all commands have been textually substituted by the associated standard LaTeX expressions, or should I have to recur to the powers of Emacs?

• emacs is your friend Aug 24 '17 at 10:58
• publishers are exhibiting good sense when they tell you not to redefine commands that already exist. but if they tell you you shouldn't define a new command that ensures consistency in your own notation, they're spiting themselves. the only places where it's not wise to use author-defined commands is in top matter (title, abstract, and the like) and bibliography; those elements are often sent on to "aggregators" and indexers, who are (understandably) not equipped to deal with the proliferation of such code. Aug 24 '17 at 13:12
• @Aditya -- the ams transforms the top matter and bibliography to html to post with online journal contents pages. these elements need to be free of author-defined macros. otherwise, it is usually appreciated that an author has taken care to make notation consistent, as long as existing commands and one-letter command names are avoided. there is no intermediate xml; the html processor used is able to go directly into mathjax. Aug 24 '17 at 16:11
• @barbarabeeton, but surely there is an issue whereby one can never keep track of all the commands that already exist, especially in the journal's own internal workflow? For example, I recently got back some proofs that made it clear that the journal style involved some internal hackery with \ref that (I discovered) made it incompatible with my own internal hackery with \ref, but in totally incomprehensible ways. (My hackery left \ref itself untouched, just defined a raft of auxiliary commands.) Jan 9 '19 at 14:39

One publisher's position.

The American Mathematical Society publishes nearly all its books and journals using LaTeX, and with a volume of more than 10,000 pages a year, requires consistency in the source files.

Certain components of a published work are provided to outside organizations -- aggregators and indexers -- for further dissemination. These components include the bibliographic information (essentially the front matter or top matter), the abstract, and the reference list/bibliography. The organizations handling this material are usually not equipped to handle LaTeX (or mathematical notation, for that matter), and in particular, do not have the definitions available that an author has created. In order for this "shared" material to be intelligible, it must therefore be reduced to the least common denominator -- no author-defined macros.

For this reason, authors are requested to refrain from using macros that they have defined in titles, abstracts, and bibliographies. There may be further restrictions -- LaTeX notation is not recognized in PDF bookmarks, so alternate representation should be provided.

Another source of problems is the redefinition by an author of existing commands. Redefinition of, for example, \c, can come to grief when an author with a French name appears in the bibliography (which is "normalized" in AMS publications to the form used in MathSciNet). If the \c was defined to be something that can appear only in a mathematical context, then an error message will result; if, however, the redefinition can appear in text, it may be overlooked, and discovered only after the work has been published -- a possible embarrassment for the author.

However, author definitions for commonly used mathematical notation are encouraged for the main text, as this enhances consistency and can aid in comprehension for a sightless reader who depends on an audio interface from the source file. (Well chosen macro names, ones that are meaningful in context, are important in this situation. This means a name that is not just easy to type, but a term that clearly identifies its target.) Use of one-letter macro names is a bad idea, for reasons of both ambiguity (already defined) and clarity (what does it mean?).

At the AMS, if an author does not follow these instructions, unless there are significant other problems with a submission, the problems will simply be cleaned up in-house. However, since any "tinkering" with a file carries some danger of introducing errors, it is in an author's best interests to follow the guidelines.

Responding to some questions posed in comments, it should be noted that the AMS production stream does not incorporate an xml/html translation, except for a "final" translation to html + mathjax for posting of bibliographical material and abstracts on web pages. Further, when a publication (either a journal or a proceedings collection) contains multiple papers by different authors, each one is processed individually (so author-defined material is not merged or compromised) and the separately composed pdf files are combined into a volume by processes external to LaTeX.