[texhax] Smart periods?

Barbara Beeton bnb at ams.org
Sun Nov 4 21:03:46 CET 2012


On Sun, 4 Nov 2012, Michael Barr wrote:

    Surely someone has solved this problem.  The online journal I do tex
    editing for uses \subsection and \subsubsection run in to the text.  The
    problem is that we want to add a period to the title unless there is
    already a punctuation mark.  But I have seen the following in authors'
    texts (even my own, I must admit).
    \subsection{This is a subsection}
    \subsection{This is a subsection.}
    \subsection{Is this a subsection?}
    \subsection{This is an amazing subsection!}
    and I would want to automatically add a period to the first form and
    leave the remaining three unchanged.  This is also an issue for the
    starred version.  I have tried a couple of solutions, none of which quite
    worked.  Yet it seems like an obvious thing for someone to have dealt
    with.

take a look at the definition of \nopunct and
the handling of \spacefactor in amsart.cls.
it is used like this:
  \subsection{This is an amazing subsection!\nopunct}
good luck.
						-- bb


More information about the texhax mailing list