i promised another answer, and here's an outline.
create two new commands, \noTOC and \TOConly that can be applied to text within
a heading argument. for the table of contents, \def\noTOC#1{} to ignore its
argument and \def\TOConly#1{#1} to set this material; when setting the heading
itself, \def\TOConly#1{} to ignore, and \def\noTOC#1{#1} to output.
at the ams, we are using this technique in production, and the definitions are
buried in a config file. some of these definitions are embedded in other definitions
that are rather complicated, and i haven't yet managed to tease out a minimal set of
definitions that can be added to the preamble of a document without fouling up anything
else. part of the problem is that running heads have to be handled correctly at the
same time. there have been requests from authors for this facility, and it is on our
list of things to be considered, and probably implemented, in the next upgrade of
the ams document classes. but i do hope to have a standalone patch before then, which i
will post here.
this method works very well for two versions of a heading that differ only slightly, such as adding a linebreak in either the toc or in-text heading (but not both, or in separate locations) or omitting or changing a few words. but it should probably work equally well
to give totally different texts for the two locations.
\...code...``); and to format code blocks, prepend four spaces to each line. Alternatively, the101010button will do what you want. – Antal Spector-Zabusky Jan 03 '11 at 04:24amsclassmanual this is desired behavior and not a bug. After all the class is for producing articles for publication in AMS journals. The code listed in the manual might give a hint on how to hack it though. – Carsten Thiel Jan 03 '11 at 06:32