<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% sgmlcmpt.sty
%
% (c) Copyleft 1999 J"org Knappen
% Licence: GNU licence version 2
% Documentation: See after \endinput
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sgmlcmpt}[1999/06/01]
\newcommand*\amp{\&amp;}
\newcommand*\lt{&lt;}
\newcommand*\gt{&gt;}
\newcommand*\clmn{&amp;}
\endinput

Unfortunately, one cannot embed LaTeX formulae into SGML as #PCDATA. The
reason is, that a LaTeX formula can contain the characters "&lt;" and "&amp;" which
have a special meaning in SGML.

This little package defines four control sequences to circumvent the
restriction: 

\lt   &lt; (less than)
\gt   &gt; (greater than)
\amp  \&amp; (ampersand sign)
\clmn &amp; (column separator)

\gt is only provided for aesthetical reasons; the asymmetry between \lt 
and &gt; looks ugly to the author of this package. 

The usual catcodes for &gt;, &lt;, and &amp; are assumed while the package is read in.

The following little sed script will make all your TeX formulae SGML #PCDATA

s/&lt;/\\lt /g
s/&gt;/\\gt /g
s/\\&amp;/{\\amp}/g
s/&amp;/\\clmn /g

Fine print

Note the spaces inserted after \lt,\gt, and \clmn: They guarantee that the
control words are ended properly. There shouldn't be any spaces eaten up, since
"&gt;" and "&lt;" are not intended to be input in text (horizontal) mode. With 
standard TeX fonts they produce surprising results anyway. Leading spaces after
a column separator are ignored by TeX, so no problem here.

Turning the control symbol \&amp; into a control word \amp may cause the loss of
significant spaces, therefore the additional group here. The group should
cause no harm, since \&amp; is alreday of math type "other". It may suppress
a hypothetical ligature or kern between the ampersand sign and a following
character in text mode depending on how many passes TeX needs in order to
typeset the paragraph. The standard TeX fonts don't contain such ligatures
or kerns.

J"org Knappen, Barbarossaring 43, D-55118 Mainz, Allemagne
Author of the Book: Schnell ans Ziel mit LaTeX2e, Oldenbourg-Verlag
M"unchen, 1997, ISBN 3-486-24199-0.
% /sgmlcmpt.sty
</pre></body></html>