[OS X TeX] Unpacking macros

Axel Kielhorn tex at axelkielhorn.de
Tue Mar 25 13:05:57 CET 2014

Am 25.03.2014 um 11:13 schrieb Nitecki, Zbigniew H.:

> I have a simple question, but will outline the context because I may be asking the wrong question.
> I have a paper provisionally accepted by a prominent journal, which has been creating massive headaches at the technical, production end.  The paper is written in latex, using the amsart document class;  it is nine pages long.  I tend to use a lot of macros

What kind of macros are these?
Simple abbreviations or complex macros?

There is the \listfiles command that lists all the packages used, but that would probably not help you.

To find all the macros you *use* try the following:

Make a copy of the file.
Delete all comments.
Replace every space with a carriage return.
Remove the space at the beginning of the line.
Delete all lines *not* starting with \.
sort -u the file.

This will give you a good approximation of the macros used.
Now you can remove all the standard macros.
The remaining macros may be the offending ones.

Look into your local style file for the definitions and replace them.

> When I do, certain strange things happen, like no author listing.

Do you have an \author{} command or did you define something yourself?
Does the journal have an \author{} command or does it require something else?

> The journal's technical staff went to work on the paper, and after weeks of work produced a version in which (for example) the author name does appear, but now all kinds of notation generated by my macros is rendered in garbled form.

Weeks sounds strange.
When they have your local macro definitions available it should rather take hours.
(Not promising anything here.)

> His final email to me asks that I submit the paper in article style with no author-written style files.  So I want to cull the various macros I have actually used in this paper and put them directly into the preamble of my source file.

This may be suboptimal, there may be name conflicts.
It may be better to replace the use of the macros by their definition.
But this depends on the kind of macros you use.

> A more subtle (and probably hopeless) version asks if there is a way to automatically "unpack" the definitions of these macros so that the macros themselves are no longer needed.  I know this is the opposite of progress, but doing something like this (automatically or "by hand") seems to be the only way to resolve the technical issues which so far threaten to prevent publication.

sed may be your friend here, something like:


This substitutes the
where \1 is the contents of the \( \) in the first part.

You can put all the replacement commands in a file and call

sed -f <filename>

But this is advanced Unix magic.

It is difficult to be more specific without knowing you document and the journal style file.


More information about the macostex-archives mailing list