| 1 |
% sgmlcmpt.sty |
| 2 |
% |
| 3 |
% (c) Copyleft 1999 J"org Knappen |
| 4 |
% Licence: GNU licence version 2 |
| 5 |
% Documentation: See after \endinput |
| 6 |
\NeedsTeXFormat{LaTeX2e} |
| 7 |
\ProvidesPackage{sgmlcmpt}[1999/06/01] |
| 8 |
\newcommand*\amp{\&} |
| 9 |
\newcommand*\lt{<} |
| 10 |
\newcommand*\gt{>} |
| 11 |
\newcommand*\clmn{&} |
| 12 |
\endinput |
| 13 |
|
| 14 |
Unfortunately, one cannot embed LaTeX formulae into SGML as #PCDATA. The |
| 15 |
reason is, that a LaTeX formula can contain the characters "<" and "&" which |
| 16 |
have a special meaning in SGML. |
| 17 |
|
| 18 |
This little package defines four control sequences to circumvent the |
| 19 |
restriction: |
| 20 |
|
| 21 |
\lt < (less than) |
| 22 |
\gt > (greater than) |
| 23 |
\amp \& (ampersand sign) |
| 24 |
\clmn & (column separator) |
| 25 |
|
| 26 |
\gt is only provided for aesthetical reasons; the asymmetry between \lt |
| 27 |
and > looks ugly to the author of this package. |
| 28 |
|
| 29 |
The usual catcodes for >, <, and & are assumed while the package is read in. |
| 30 |
|
| 31 |
The following little sed script will make all your TeX formulae SGML #PCDATA |
| 32 |
|
| 33 |
s/</\\lt /g |
| 34 |
s/>/\\gt /g |
| 35 |
s/\\&/{\\amp}/g |
| 36 |
s/&/\\clmn /g |
| 37 |
|
| 38 |
Fine print |
| 39 |
|
| 40 |
Note the spaces inserted after \lt,\gt, and \clmn: They guarantee that the |
| 41 |
control words are ended properly. There shouldn't be any spaces eaten up, since |
| 42 |
">" and "<" are not intended to be input in text (horizontal) mode. With |
| 43 |
standard TeX fonts they produce surprising results anyway. Leading spaces after |
| 44 |
a column separator are ignored by TeX, so no problem here. |
| 45 |
|
| 46 |
Turning the control symbol \& into a control word \amp may cause the loss of |
| 47 |
significant spaces, therefore the additional group here. The group should |
| 48 |
cause no harm, since \& is alreday of math type "other". It may suppress |
| 49 |
a hypothetical ligature or kern between the ampersand sign and a following |
| 50 |
character in text mode depending on how many passes TeX needs in order to |
| 51 |
typeset the paragraph. The standard TeX fonts don't contain such ligatures |
| 52 |
or kerns. |
| 53 |
|
| 54 |
J"org Knappen, Barbarossaring 43, D-55118 Mainz, Allemagne |
| 55 |
Author of the Book: Schnell ans Ziel mit LaTeX2e, Oldenbourg-Verlag |
| 56 |
M"unchen, 1997, ISBN 3-486-24199-0. |
| 57 |
% /sgmlcmpt.sty |