/[cmucl]/src/docs/cmu-user/typehtml.dtx
ViewVC logotype

Contents of /src/docs/cmu-user/typehtml.dtx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Thu Feb 14 00:57:27 2008 UTC (6 years, 2 months ago) by rtoy
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, post-merge-intl-branch, merged-unicode-utf16-extfmt-2009-06-11, unicode-utf16-extfmt-2009-03-27, snapshot-2008-08, snapshot-2008-09, sse2-packed-2008-11-12, snapshot-2008-05, snapshot-2008-06, snapshot-2008-07, snapshot-2008-03, intl-branch-working-2010-02-19-1000, unicode-string-buffer-impl-base, sse2-base, release-20b-pre1, release-20b-pre2, unicode-string-buffer-base, sse2-packed-base, sparc-tramp-assem-2010-07-19, amd64-dd-start, release-19f-pre1, snapshot-2008-12, snapshot-2008-11, intl-2-branch-base, release-19e, release-19d, GIT-CONVERSION, unicode-utf16-sync-2008-12, cross-sol-x86-merged, label-2009-03-16, release-19f-base, merge-sse2-packed, merge-with-19f, intl-branch-working-2010-02-11-1000, unicode-snapshot-2009-05, unicode-snapshot-2009-06, unicode-utf16-sync-2008-07, unicode-utf16-sync-2008-09, unicode-utf16-extfmts-sync-2008-12, RELEASE_20b, snapshot-2008-04, unicode-utf16-sync-label-2009-03-16, RELEASE_19f, release-20a-base, cross-sol-x86-base, unicode-utf16-char-support-2009-03-26, unicode-utf16-char-support-2009-03-25, unicode-utf16-extfmts-pre-sync-2008-11, snapshot-2008-10, snapshot-2010-12, snapshot-2010-11, unicode-utf16-sync-2008-11, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, pre-merge-intl-branch, release-19e-pre1, release-19e-pre2, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, snapshot-2010-06, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, snapshot-2010-08, label-2009-03-25, cross-sol-x86-2010-12-20, sse2-checkpoint-2008-10-01, intl-branch-2010-03-18-1300, sse2-merge-with-2008-11, sse2-merge-with-2008-10, RELEASE_20a, release-20a-pre1, snapshot-2009-11, snapshot-2009-12, unicode-utf16-extfmt-2009-06-11, portable-clx-import-2009-06-16, unicode-utf16-string-support, cross-sparc-branch-base, release-19e-base, intl-branch-base, unicode-utf16-base, portable-clx-base, snapshot-2009-08, snapshot-2009-02, snapshot-2009-01, snapshot-2009-07, snapshot-2009-05, snapshot-2009-04, HEAD
Branch point for: RELEASE-19F-BRANCH, portable-clx-branch, cross-sparc-branch, RELEASE-20B-BRANCH, unicode-string-buffer-branch, sparc-tramp-assem-branch, sse2-packed-branch, RELEASE-20A-BRANCH, amd64-dd-branch, unicode-string-buffer-impl-branch, intl-branch, unicode-utf16-branch, cross-sol-x86-branch, release-19e-branch, sse2-branch, intl-2-branch, unicode-utf16-extfmt-branch
o Update date
o Use typehtml package instead of html.
o Add typehtml.dtx, typehtml.ins, and typehtml.sty.
1 %
2 % \iffalse
3 %%
4 %% Source File `typehtml.dtx'.
5 %% Copyright (C) 1996 1997 David Carlisle
6 %% This file may be distributed under the terms of the LPPL.
7 %% See 00readme.txt for details.
8 %%
9 %
10 %<*dtx>
11 \ProvidesFile{typehtml.dtx}
12 %</dtx>
13 %<package>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
14 %<package>\ProvidesPackage{typehtml}
15 %<driver>\ProvidesFile{typehtml.drv}
16 % \fi
17 % \ProvidesFile{typehtml.dtx}
18 [1997/11/19 v0.12 HTML printer (DPC)]
19 %
20 % \iffalse
21 %<*driver>
22 \documentclass{ltxdoc}
23 \usepackage[html3,subsection*,bigint]{typehtml}
24 \DocInput{typehtml.dtx}
25 \end{document}
26 %</driver>
27 % \fi
28 %
29 % \GetFileInfo{typehtml.dtx}
30 % \begin{document}
31 % \title{The \textsf{typehtml} package\thanks{This file
32 % has version number \fileversion, last
33 % revised \filedate.}}
34 % \author{David Carlisle}
35 % \date{\filedate}
36 %
37 % \changes{v0.01}{1996/03/06}{Initial version}
38 % \changes{v0.02}{1996/03/07}{Fiddling}
39 % \changes{v0.03}{1996/03/08}{HTML3 maths}
40 % \changes{v0.05}{1996/03/11}
41 % {change name to prevent clash with html package in latex2html}
42 % \changes{v0.11}{1996/03/28}{Minor improvements}
43 % \changes{v0.12}{1997/11/29}{Assorted changes for Bernard Gaulle, active
44 % french punctuation}
45 % \maketitle
46 %
47 % \CheckSum{2283}
48 %
49 % \section{Intoduction}
50 %
51 % This package enables the processing of HTML codes. The
52 % \verb|\dohtml| command
53 % allows fragments of HTML to be placed within a \LaTeX\
54 % document,
55 %\begin{verbatim}
56 % \dohtml
57 % <html>
58 % html markup ...
59 % </html>
60 %\end{verbatim}
61 % The \verb|<html>|\ldots\verb|</html>| is \emph{required}. (It is
62 % anyway a good idea to have these tags in an HTML document.)
63 %
64 % The \verb|\htmlinput| command is similar, but takes a file
65 % name as argument. In that case the file need not necessarily start
66 % and end with \verb|<html>|\ldots\verb|</html>|.
67 %
68 % This package covers most of the HTML2 DTD, together with the
69 % mathematics extensions from HTML3.\footnote
70 % {The draft specification of HTML3 has expired, and the W3C group
71 % are currently devising a new proposed extension of HTML, so the
72 % mathematics typesetting part of this package may need substantial
73 % revision once a final specification of the HTML mathematics markup
74 % is agreed.}
75 % The rest of HTML3 may be added at a later date.
76 %
77 % Its current incarnation has not been extensively tested, having been
78 % thrown together during the last couple of weeks in response to a
79 % question on \texttt{comp.text.tex} about the availability of such a
80 % package.
81 %
82 % The package falls into three sections. Firstly the options section
83 % allows a certain amount of customisation, and enabling of
84 % extensions. Not all these options are fully operational at present.
85 % Secondly comes a section that implements a kind of SGML parser. This
86 % is not a real conforming SGML parser (not even a close approximation
87 % to such a thing!) The assumption (sadly false in the anarchic WWW)
88 % is that any document will have been validated by a conforming SGML
89 % parser before it ever gets to the stage of being printed by this
90 % package. Finally are a set of declarations that essentially map the
91 % declarations of the HTML DTD into \LaTeX\ constructs.
92 %
93 % \section{Options}
94 %
95 % \subsection{HTML Level}
96 % The options \texttt{html2} (the default) and \texttt{html3} control
97 % HTML variant supported. Using the \texttt{html3} option will use up a
98 % lot more memory to support the extra features, and the math entity
99 % (symbol) names. Against my better judgement there is also a
100 % \texttt{netscape} option to allow some of the non-HTML tags accepted
101 % by that browser.
102 %
103 % \subsection{Headings}
104 % The six options \texttt{chapter}, \texttt{chapter*}, \texttt{section},
105 % \texttt{section*}, \texttt{subsection} and \texttt{subsection*}
106 % Determine to which \LaTeX\ sectional command the HTML element
107 % \texttt{h1} is mapped. (\texttt{h2}--\texttt{h6} will
108 % automatically follow suit.) The default is \texttt{section*}.
109 %
110 % \subsection{Double Quote Handling}
111 % Most HTML pages use |"| as as a quotation mark in text, for
112 % example:
113 %\begin{verbatim}
114 % quoted "like this" example
115 %\end{verbatim}
116 %
117 % This slot in the ISO latin-1 encoding is for `straight' double
118 % quotes. Unfortunately the Standard \TeX\ fonts in the OT1 encoding
119 % do not have such a character, only left and right quotes, ``like
120 % this''. By default this package uses the \texttt{straightquotedbl}
121 % option which uses the \LaTeX\ command |\textquotedbl| to render
122 % |"|. If used with the T1 encoded fonts |\usepackage[T1]{fontenc}|
123 % then the straight double quote from the current font is used. With
124 % OT1 fonts, the double quote is taken from the |\ttfamily| font,
125 % which looks \texttt{"}like this\texttt{"} which is fairly
126 % horrible, but better than the alternative which is ''like this''.
127 %
128 % The \texttt{smartquotedbl} option redefines |"| so that it produces
129 % alternatively an open double quote `` then a close ''. As there is a
130 % chance of it becoming confused, it is reset to `` at the beginning
131 % of every paragraph, whatever the current mode.
132 %
133 % Neither of these options affects the use of |"| as part of the SGML
134 % syntax to surround attribute values.
135 %
136 % In principle the package ought to have similar options dealing with
137 % the single quote, but there the situation is more complicated due to
138 % its dual use as an apostrophe, so currently the package takes no
139 % special precautions: all single quotes are treated as a closing
140 % quote/apostrophe. Also the conventions of `open' and `close' quotes
141 % only really apply to English. If someone wants to suggest what the
142 % package should do with |"| in other languages\ldots
143 %
144 % \subsection{Images}
145 % The default option is \texttt{imgalt} This means that all inline
146 % images (the HTML \texttt{img} element) are replaced by the text
147 % specified by the \texttt{alt} attribute, or \textsf{[image]} if no
148 % such attribute is specified.
149 %
150 % The \texttt{imggif} option\footnote{one day} uses the
151 % \verb|\includegraphics| command so that inline images appear as
152 % such in the printed version.
153 %
154 % The \texttt{imgps} option\footnotemark[1] is similar to
155 % \texttt{imggif} but first replaces the extension \texttt{.gif} at
156 % the end of the source file name by \texttt{.ps}. This will enable
157 % drivers that can not include GIF files to be used, as long as the
158 % user keeps the image in both PostScript and Gif formats.
159 %
160 % \subsection{Hyperref}
161 %
162 % Several options control how the HTML anchor tag is treated.
163 %
164 % The default \texttt{nohyperref} option ignores name anchors, and
165 % typesets the body of src anchors using |\emph|.
166 %
167 % The \texttt{ftnhyperref} option is similar to \texttt{nohyperref},
168 % but adds a footnote showing the destination address of each link,
169 % as specified by the SRC attribute.
170 %
171 % If the \texttt{hyperref} option is specified, the hypertext markup
172 % in the HTML file will be replicated using the
173 % hypertext specials of the Hyper\TeX\ group. If in addition the
174 % \textsf{hyperref} package is loaded, the extra features of that
175 % package may be used, for instance producing `native PDF' specials
176 % for direct use by Adobe distiller rather than producing the specials
177 % of the hyper\TeX\ conventions.
178 %
179 % The \texttt{dviwindo} option converts the hypertext information in
180 % the HTML into the |\special| conventions of Y\&Y's \emph{dviwindo}
181 % previewer for Microsoft Windows.
182 %
183 % \subsection{Big Integrals}
184 % \LaTeX\ does not treat integral signs as variable sized symbols,
185 % in the way that it treats delimiters such as brackets. In common
186 % with summation signs and a few other operators, they come in
187 % just two fixed sizes, a small version for inline mathematics, and a
188 % large version used in displays. In fact by default \LaTeX\ always
189 % uses the same two sizes (from the 10\,pt math extension font) even if
190 % the document class has been specified with a size option such as
191 % \texttt{12pt}, or if a size command such as |\large| has been used.
192 %
193 % The standard \textsf{exscale} package loads the math extension font
194 % at larger sizes if the current font size is larger than 10\,pt.
195 %
196 % The HTML3 math description explicitly states that integral signs
197 % should be treated like delimiters and stretch if applied to a large
198 % math expression. By default this package ignores this advice and
199 % treats integral signs in the standard way, however an option
200 % \texttt{bigint} does cause integral signs to `stretch' (or at least
201 % be taken from a suitably large font). The standard Computer Modern
202 % fonts use a very `sloped' integral which means that they are
203 % not really suitable for being stretched. Some other math fonts, for
204 % instance Lucida, have more vertical integral signs, and one could
205 % imagine in those cases making an integral sign with a `repeatable'
206 % vertical middle section so that it could grow to an arbitrary size, in
207 % the way that brackets grow.
208 %
209 % \section{Latin-1 characters}
210 % The SGML character entities for the ISO-Latin1 characters such as
211 % \texttt{\&eacute;} are recognised by this style, although as usual,
212 % some of them such as the Icelandic thorn character,
213 % \texttt{\&thorn;}, \verb|\th|, produce an error if the old `OT1'
214 % encoded fonts are being used. These characters will print correctly
215 % if `T1' encoded fonts are used, for example by declaring
216 % \verb|\usepackage[T1]{fontenc}|~.
217 %
218 % HTML also allows direct 8-bit input of characters according to the
219 % ISO-latin1 encoding, to enable this you need to enable latin-1 input
220 % for \LaTeX\ with a declaration such as
221 % \verb|\usepackage[latin1]{inputenc}|~.
222 %
223 % \section{Mathematics}
224 % The HTML3 MATH element is fairly well supported, including the BOX
225 % and CLASS attributes. (Currently only CHEM value for class is
226 % supported, and as far as I can see the BOX attribute is only in the
227 % report, not in the dtd.) The super and subscripts are supported,
228 % including the shortref maps, however only the default right
229 % alignment is
230 % implemented so far. The convention described in the draft report
231 % for using white space to distinguish superscript positioning is
232 % fairly \emph{horrible}!
233 %
234 %
235 % The documentation that I could find on HTML3 did not include a full
236 % list of the entity names to be used for the symbols. This
237 % package currently \emph{only} defines the following entities, which
238 % should be enough for testing purposes at least.
239 %
240 % \begin{itemize}
241 % \item
242 % |gt| ($>$) |lt| ($<$) (Already in the HTML2 DTD)
243 %
244 % \item
245 % Some Greek letters.
246 %
247 % |alpha| ($\alpha$)
248 % |beta| ($\beta$)
249 % |gamma| ($\gamma$)
250 % |Gamma| ($\Gamma$)
251 %
252 % \item
253 % Integral and Sum. $\int$ grows large if the \texttt{bigint} package
254 % option is given.
255 %
256 % |int| ($\int$)
257 % |sum| ($\sum$)
258 %
259 % \item
260 % Braces (The delimiters ()[] also stretch as expected in the BOX
261 % element)
262 %
263 % |lbrace| ($\lbrace$)
264 % |rbrace| ($\rbrace$)
265 %
266 % \item
267 % A random collection of mathematical symbols:
268 %
269 % |times| ($\times$)
270 % |cup| ($\cup$)
271 % |cap| ($\cap$)
272 % |vee| ($\vee$)
273 % |wedge| ($\wedge$)
274 % |infty| ($\infty$)
275 % |oplus| ($\oplus$)
276 % |ominus| ($\ominus$)
277 % |otimes| ($\otimes$)
278 %
279 % \item
280 % A Minimal set of trig functions:
281 %
282 % |sin| ($\sin$)
283 % |cos| ($\cos$)
284 % |tan| ($\tan$)
285 %
286 % \item
287 % Also in the special context as attributes to ABOVE and BELOW elements
288 % the entities:
289 %
290 % |overbrace| ($\overbrace{\quad}$)
291 % |underbrace| ($\underbrace{\quad}$) and any (\TeX) math accent name.
292 %
293 % \end{itemize}
294 %
295 % \section{SGML Minimisation features}
296 % SGML (and hence HTML) support various minimisation features that aim
297 % to make it easier to enter the markp `by hand'. These features make
298 % the kind of `casual' attempt at parsing SGML as implemented in this
299 % package somewhat error prone.
300 %
301 % Two particular features are enabled in HTML. The so called SHORTTAG
302 % feature means that the name of a tag may be omitted if it may be
303 % inferred from the context. Typically in HTML this is used in
304 % examples like
305 %\begin{verbatim}
306 % <title>A Document Title</>
307 %\end{verbatim}
308 % The end tag is shortened to |</>| and the system infers that
309 % TITLE is the element to be closed.
310 %
311 % The second form of minimisation enabled in HTML is the OMITTAG
312 % feature. Here a tag may be omitted altogether in certain
313 % circumstances.
314 % A typical example is the HTML list, where each list item is started
315 % with |<li>| but the closing |</li>| at the end of the item may be
316 % omitted and inferred by the following |<li>| or |</ol>| tag.
317 %
318 % This package is reasonably robust with respect to omitted
319 % tags. However it only makes a half hearted attempt at supporting the
320 % SHORTTAG feature. The TITLE example above would work, but nested
321 % elements, with multiple levels of minimised end tags will probably
322 % break this package.
323 %
324 % It would be possible to build a \LaTeX\ system that had full
325 % knowledge of the HTML (or any other) DTD and in particular the
326 % `content model' of every element, this would produce a more robust
327 % parsing system but would take longer than I was prepared to
328 % spend this week\ldots\ In anycase if you need a fully conforming SGML
329 % parser, it probably makes sense to use an existing one (excellent
330 % free parsers are freely available) and then convert the output of
331 % the parser to a form suitable for \LaTeX. In that way all such
332 % concerns about SGML syntax features such as minimisation will have
333 % been resolved by the time \LaTeX\ sees the document.
334 %
335 % \section{Examples}
336 % \let\olddohtml\dohtml
337 % \def\dohtml{\olddohtml\MakePercentIgnore}
338 %
339 %
340 % \subsection{A section}
341 % This document uses the \texttt{subsection*} option.
342 %\begin{verbatim}
343 % <h1>HTML and LaTeX</h1>
344 %\end{verbatim}
345 % \dohtml
346 % <html>
347 % <h1>HTML and LaTeX</h1>
348 % </html>
349 %
350 % \subsection{An itemised list}
351 %\begin{verbatim}
352 % <ul>
353 % <li> something
354 % <li> something else
355 % </ul>
356 %\end{verbatim}
357 % \dohtml
358 % <html>
359 % <ul>
360 % <li> something
361 % <li> something else
362 % </ul>
363 % </html>
364 %
365 % \subsection{Latin1 Characters}
366 %\begin{verbatim}
367 % &eacute; &ouml;
368 %\end{verbatim}
369 % \dohtml
370 % <html>
371 % &eacute; &ouml;
372 % </html>
373 %
374 % \subsection{Images}
375 % Currently only the ALT attribute is supported.
376 %\begin{verbatim}
377 % This is an image of me <img alt="DPC" src="dpc.gif">
378 %\end{verbatim}
379 % \dohtml
380 % <html>
381 % This is an image of me <img alt="DPC" src="dpc.gif">
382 % </html>
383 %
384 % \subsection{A Form}
385 %\begin{verbatim}
386 % <form
387 % action="http://www.cogs.susx.ac.uk/cgi-bin/ltxbugs2html"
388 % method=get><hr>
389 % You can search for all the bug reports about: <select name="category">
390 % <option>AMS LaTeX</option>
391 % <option>Babel</option>
392 % <option>Graphics and colour</option>
393 % <option>LaTeX</option>
394 % <option selected>Metafont fonts</option>
395 % <option>PostScript fonts</option>
396 % <option>Tools</option>
397 % </select>
398 % <hr>
399 % </form>
400 %\end{verbatim}
401 % \dohtml
402 % <html>
403 % <form
404 % action="http://www.cogs.susx.ac.uk/cgi-bin/ltxbugs2html"
405 % method=get><hr>
406 % You can search for all the bug reports about: <select name="category">
407 % <option>AMS LaTeX</option>
408 % <option>Babel</option>
409 % <option>Graphics and colour</option>
410 % <option>LaTeX</option>
411 % <option selected>Metafont fonts</option>
412 % <option>PostScript fonts</option>
413 % <option>Tools</option>
414 % </select>
415 % <hr>
416 % </form>
417 % </html>
418 %
419 % \subsection{Styles of Mathematics}
420 %\begin{verbatim}
421 % <math>
422 % H_2_O + CO_2_
423 % </math>
424 % <math class=chem>
425 % H_2_O + CO_2_
426 % </math>
427 % <math box>
428 % H_2_O + CO_2_
429 % </math>
430 % <math class=chem box>
431 % H_2_O + CO_2_
432 % </math>
433 %\end{verbatim}
434 % \dohtml
435 % <html>
436 % <math>
437 % H_2_O + CO_2_
438 % </math>
439 % <math class=chem>
440 % H_2_O + CO_2_
441 % </math>
442 % <math box>
443 % H_2_O + CO_2_
444 % </math>
445 % <math class=chem box>
446 % H_2_O + CO_2_
447 % </math>
448 % </html>
449 %
450 % \subsection{Integrals}
451 % Stretchy integrals with the \texttt{bigint} option.
452 %\begin{verbatim}
453 % <math>
454 % {&int;^1^_3_<left>
455 % 1
456 % <over>
457 % {x+{1<over>x+{2<over>x+
458 % {3<over>x+{4<over>x}}}}}
459 % <right>dx}
460 % </math>
461 %\end{verbatim}
462 % \dohtml
463 % <html>
464 % <math>
465 % {&int;^1^_3_<left>
466 % 1
467 % <over>
468 % {x+{1<over>x+{2<over>x+
469 % {3<over>x+{4<over>x}}}}}
470 % <right><t>d</t> x}
471 % </math>
472 % </html>
473 % And the same integral with the standard integral sign.
474 % \begingroup
475 % \makeatletter
476 % \let\HTML@bigint\int
477 % \dohtml
478 % <html>
479 % <math>
480 % {&int;^1^_3_<left>
481 % 1
482 % <over>
483 % {x+{1<over>x+{2<over>x+
484 % {3<over>x+{4<over>x}}}}}
485 % <right><t>d</t>x}
486 % </math>
487 % </html>
488 % \endgroup
489 %
490 % \subsection{Oversized delimiters}
491 %\begin{verbatim}
492 % <math>
493 % <box>(<left>1 <atop> 2 <right>)</box>
494 % <box size=large>(<left>1 <atop> 2 <right>)</box>
495 % </math>
496 %\end{verbatim}
497 % \dohtml
498 % <html>
499 % <math>
500 % <box>(<left>1 <atop> 2 <right>)</box>
501 % <box size=large>(<left>1 <atop> 2 <right>)</box>
502 % </math>
503 % </html>
504 %
505 % \subsection{Roots, Overbraces etc}
506 %\begin{verbatim}
507 % <math>
508 % <above sym=overbrace> abc </above><sup>k</sup>
509 % &emsp;
510 % <root>3<of>x</root>
511 % <sqrt>5</sqrt>
512 % &emsp;
513 % <below sym=underline> abc </below>
514 % <above sym=widehat> abc </above>
515 % </math>
516 %\end{verbatim}
517 % \dohtml
518 % <html>
519 % <math>
520 % <above sym=overbrace> a bc </above><sup>k</sup>
521 % &emsp;
522 % <root>3<of>x</root>
523 % <sqrt>5</sqrt>
524 % &emsp;
525 % <below sym=underline> abc </below>
526 % <above sym=widehat> abc </above>
527 % </math>
528 % </html>
529 %
530 % \subsection{Arrays}
531 %
532 %\begin{verbatim}
533 % <math>
534 % aa<array align=top>
535 % <row><item><text>first col</text><item><text>second col</text><item>
536 % <text>third col</text><item><text>fourth col</text>
537 % <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_
538 % <row><item><text>row 3</text><item rowspan=3 colspan=2>
539 % a_32_-a_53_<item>a_34_
540 % <row><item><text>row 4</text><item>a_44_
541 % <row><item><text>row 5</text><item>a_54_
542 % <row><item><text>row 6</text><item align=left>
543 % al_62_<item>a_63_<item>a_64_
544 % <row><item><text>row 7</text><item align=right>
545 % ar_72_<item>a_73_<item>a_74_
546 % </array>bb
547 % </math>
548 %\end{verbatim}
549 %
550 % \dohtml
551 % <html>
552 % <math>
553 % aa<array align=top>
554 % <row><item><text>first col</text><item><text>second col</text><item>
555 % <text>third col</text><item><text>fourth col</text>
556 % <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_
557 % <row><item><text>row 3</text><item rowspan=3 colspan=2>
558 % a_32_-a_53_<item>a_34_
559 % <row><item><text>row 4</text><item>a_44_
560 % <row><item><text>row 5</text><item>a_54_
561 % <row><item><text>row 6</text><item align=left>
562 % al_62_<item>a_63_<item>a_64_
563 % <row><item><text>row 7</text><item align=right>
564 % ar_72_<item>a_73_<item>a_74_
565 % </array>bb
566 % </math>
567 % </html>
568 %
569 % Repeat that element, but change the ARRAY attributes as follows:
570 %\begin{verbatim}
571 % <array ldelim="(" rdelim=")" labels>
572 %\end{verbatim}
573 %
574 % \dohtml
575 % <html>
576 % <math>
577 % aa<array ldelim="(" rdelim=")" labels>
578 % <row><item><text>first col</text><item><text>second col</text><item>
579 % <text>third col</text><item><text>fourth col</text>
580 % <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_
581 % <row><item><text>row 3</text><item rowspan=3 colspan=2>
582 % a_32_-a_53_<item>a_34_
583 % <row><item><text>row 4</text><item>a_44_
584 % <row><item><text>row 5</text><item>a_54_
585 % <row><item><text>row 6</text><item align=left>
586 % al_62_<item>a_63_<item>a_64_
587 % <row><item><text>row 7</text><item align=right>
588 % ar_72_<item>a_73_<item>a_74_
589 % </array>bb
590 % </math>
591 % </html>
592 %
593 % and finally an example of COLSPEC
594 %\begin{verbatim}
595 % <math>
596 % <array colspec="R+C=L">
597 % <row><item>abc_11_<item>abc_12_<item>abc_13_
598 % <row><item>a_21_<item>a_22_<item>a_23_
599 % <row><item>a_31_<item>a_32_<item>a_33_
600 % </array>
601 % </math>
602 %\end{verbatim}
603 %
604 % \dohtml
605 % <html>
606 % <math>
607 % <array colspec="R+C=L">
608 % <row><item>abc_11_<item>abc_12_<item>abc_13_
609 % <row><item>a_21_<item>a_22_<item>a_23_
610 % <row><item>a_31_<item>a_32_<item>a_33_
611 % </array>
612 % </math>
613 % </html>
614 %
615 % \subsection{Tables}
616 % HTML3 tables are not yet supported, but there is a minimal ammount to
617 % catch simple cases.
618 %
619 %\begin{verbatim}
620 % <table>
621 % <caption>Simple Table</caption>
622 % <tr><td>one <td> two
623 % <tr><td>a <td> b
624 % </table>
625 %\end{verbatim}
626 %
627 % \dohtml
628 % <html>
629 % <table>
630 % <caption>Simple Table</caption>
631 % <tr><td>one <td> two
632 % <tr><td>a <td> b
633 % </table>
634 % </html>
635 %
636 % \StopEventually{}
637 %
638 % \section{The Code}
639 %
640 % \subsection{Option Handling}
641 % \begin{macrocode}
642 %<*package>
643 % \end{macrocode}
644 %
645 % \begin{macrocode}
646 \DeclareOption{html2}{\let\HTML@two@stop\endinput}
647 % \end{macrocode}
648 %
649 % The |#| here, and in later option code will need doubling
650 % if you are using a \LaTeX\ before June 95.
651 % \begin{macrocode}
652 \DeclareOption{netscape}
653 {\def\HTML@not#1{\SGML@w{<#1> is not valid HTML}}}
654 % \end{macrocode}
655 %
656 % \begin{macrocode}
657 \DeclareOption{html3}{\let\HTML@two@stop\relax}
658 % \end{macrocode}
659 %
660 % \changes{v0.08}{1996/03/16}{Add nohyperref option}
661 % \begin{macrocode}
662 \DeclareOption{nohyperref}{%
663 \let\HTML@doname\@secondoftwo
664 \def\HTML@dosrc#1#2{\emph{#2}}}
665 % \end{macrocode}
666 %
667 % \changes{v0.08}{1996/03/16}{Add ftnhyperref option}
668 % \begin{macrocode}
669 \DeclareOption{ftnhyperref}{%
670 \let\HTML@doname\@secondoftwo
671 \def\HTML@dosrc#1#2{\emph{#2}\footnote{HREF: \texttt{#1}}}}
672 % \end{macrocode}
673 %
674 % \changes{v0.08}{1996/03/16}
675 % {make hyperref independent of hyperref package}
676 % \begin{macrocode}
677 \DeclareOption{hyperref}{%
678 \AtBeginDocument{%
679 \providecommand\href[2]{\special{html:<A href="#1">}%
680 #2\special{html:</A>}}%
681 \providecommand\hypertarget[2]{\special{html:<A name="#1">}%
682 #2\special{html:</A>}}%
683 \let\HTML@doname\hypertarget
684 \let\HTML@dosrc\href}}
685 % \end{macrocode}
686 %
687 % \changes{v0.08}{1996/03/16}{Add dviwindo option}
688 % Dviwindo itself deals with links within a document i.e., a src
689 % attribute of the form |"#name"|. The code below detects
690 % a more general URL and fires a |launch:| action from the |\special|,
691 % which calls the non-existant command \texttt{typehtml}. Presumably
692 % this could be a batch file that calls netscape or some other WWW
693 % engine to process the URL.
694 % \begin{macrocode}
695 \DeclareOption{dviwindo}{%
696 \def\HTML@dosrc#1#2{{%
697 \leavevmode\sbox\z@{#2}\count@\ht\z@\@tempcnta\wd\z@
698 \if\string##\@car#1\@nil
699 \special{button: \the\@tempcnta\space\the\count@\space
700 "\@gobble#1"}%
701 \else
702 \special{button: \the\@tempcnta\space\the\count@\space
703 launch: typehtml "#1"}
704 \fi
705 \special{color push}\special{color rgb 0 1 0}%
706 \unhbox\z@
707 \special{color pop}}}%
708 \def\HTML@doname#1#2{\leavevmode\special{mark: "#1"}#2}}%
709 % \end{macrocode}
710 %
711 % \begin{macrocode}
712 \DeclareOption{imgalt}{}
713 % \end{macrocode}
714 %
715 % \begin{macrocode}
716 \DeclareOption{imggif}{\SGML@w{img gif support not done yet}}
717 % \end{macrocode}
718 %
719 % \begin{macrocode}
720 \DeclareOption{imgps}{\SGML@w{img ps support not done yet}}
721 % \end{macrocode}
722 %
723 % \changes{v0.10}{1996/03/25}{Add double quote handling}
724 % \begin{macrocode}
725 \DeclareOption{smartquotedbl}{%
726 \def\SGMLquotedbla{%
727 \textquotedblleft\global\let\SGMLquotedbl\SGMLquotedblb}
728 \def\SGMLquotedblb{%
729 \textquotedblright\global\let\SGMLquotedbl\SGMLquotedbla}
730 \let\SGMLquotedbl\SGMLquotedbla
731 \let\SGML@savedeverypar\everypar
732 \newtoks\everypar
733 \SGML@savedeverypar{%
734 \global\let\SGMLquotedbl\SGMLquotedbla\the\everypar}}
735 % \end{macrocode}
736 %
737 % \begin{macrocode}
738 \DeclareOption{straightquotedbl}{%
739 \DeclareTextCommandDefault{\textquotedbl}{{\ttfamily\char`\"}}%
740 \let\SGMLquotedbl\textquotedbl}
741 % \end{macrocode}
742 %
743 % \begin{macrocode}
744 \DeclareOption{chapter}{%
745 \def\HTML@headings{%
746 \chapter\section\subsection%
747 \subsubsection\paragraph\subparagraph}}
748 % \end{macrocode}
749 %
750 % \begin{macrocode}
751 \DeclareOption{chapter*}{%
752 \def\HTML@headings{%
753 {\chapter*}{\section*}{\subsection*}%
754 {\subsubsection*}{\paragraph*}{\subparagraph*}}}
755 % \end{macrocode}
756 %
757 % \begin{macrocode}
758 \DeclareOption{section}{%
759 \def\HTML@headings{%
760 \section\subsection%
761 \subsubsection\paragraph\subparagraph\endgraf}}
762 % \end{macrocode}
763 %
764 % \begin{macrocode}
765 \DeclareOption{section*}{%
766 \def\HTML@headings{%
767 {\section*}{\subsection*}%
768 {\subsubsection*}{\paragraph*}{\subparagraph*}\endgraf}}
769 % \end{macrocode}
770 %
771 % \begin{macrocode}
772 \DeclareOption{subsection}{%
773 \def\HTML@headings{%
774 \subsection%
775 \subsubsection\paragraph\subparagraph\endgraf\endgraf}}
776 % \end{macrocode}
777 %
778 % \begin{macrocode}
779 \DeclareOption{subsection*}{%
780 \def\HTML@headings{%
781 {\subsection*}%
782 {\subsubsection*}{\paragraph*}{\subparagraph*}\endgraf\endgraf}}
783 % \end{macrocode}
784 %
785 % \begin{macrocode}
786 \DeclareOption{bigint}{%
787 \let\HTML@int\int
788 \AtEndOfPackage{\RequirePackage{exscale}}}
789 % \end{macrocode}
790 %
791 % \changes{v0.08}{1996/03/16}{Make unnumbered sections the default}
792 % \begin{macrocode}
793 \ExecuteOptions{section*,imgalt,html2,nohyperref,straightquotedbl}
794 % \end{macrocode}
795 %
796 % \begin{macrocode}
797 \ProcessOptions
798 % \end{macrocode}
799 %
800 % \subsection{Fake SGML parser}
801 %
802 % \begin{macrocode}
803 \begingroup
804 % \end{macrocode}
805 %
806 % \changes{v0.12}{1997/11/29}{activate gtr and semicolon}
807 % \begin{macrocode}
808 \catcode`\<=\active
809 \catcode`\>=\active
810 \catcode`\&=\active
811 \catcode`\$=\active
812 \catcode`\"=\active
813 \catcode`\^=\active
814 \catcode`\_=\active
815 \catcode`\;=\active
816 \catcode`\A=\active
817 \catcode`\B=\active
818 \catcode`\C=\active
819 \catcode`\D=\active
820 % \end{macrocode}
821 % \changes{v0.12}{1997/11/29}{\cs{uppercase} not \cs{lowercase}}
822 % \begin{macrocode}
823 \uccode`\A=`\{%
824 \uccode`\B=`\}%
825 % \end{macrocode}
826 % \changes{v0.10}{1996/03/25}{Swap round lccodes of C and D}
827 % \changes{v0.10}{1996/03/25}{Add double quote handling}
828 % \begin{macrocode}
829 \uccode`\C=`\|%
830 \uccode`\D=`\\%
831 % \end{macrocode}
832 %
833 % \begin{macrocode}
834 \uppercase{\endgroup
835 % \end{macrocode}
836 %
837 % \begin{macro}{\SGMLent@@}
838 % \changes{v0.12}{1997/11/29}{delimit with active semicolon and gtr}
839 % \begin{macrocode}
840 \def\SGMLent@@#1;{\csname SGML@E@#1\endcsname}
841 % \end{macrocode}
842 % \end{macro}
843 %
844 % \begin{macro}{\SGMLent@@}
845 % \changes{v0.12}{1997/11/29}{macro added}
846 % \begin{macrocode}
847 \def\SGML@def@active#1>{%
848 \expandafter\def\csname SGML@#1\endcsname}
849 % \end{macrocode}
850 % \end{macro}
851 %
852 % \begin{macrocode}
853 \def\dohtml{%
854 \begingroup
855 \ifx;\@undefined\expandafter\let\expandafter;\string;\fi
856 \ifx>\@undefined\expandafter\let\expandafter>\string>\fi
857 \catcode`\<=\active
858 \catcode`\>=\active
859 \catcode`\&=\active
860 \catcode`\{=\active
861 \catcode`\}=\active
862 \catcode`\$=\active
863 \catcode`\"=\active
864 \catcode`\^=\active
865 \catcode`\_=\active
866 \catcode`\\=\active
867 \catcode`\|=\active
868 \catcode\endlinechar=10
869 \catcode`\%=12
870 \catcode`\#=12
871 \catcode`\;=\active
872 \def\verbatim@nolig@list{\do\`\do\,\do\'\do\-}
873 \def<{\SGMLopen}%
874 \def&{\SGMLent}%
875 \let^\textasciicircum
876 \let~\textasciitilde
877 \def_{\_}%
878 \let$\$%
879 \def"{\SGMLquotedbl}%
880 \def A{\{}%
881 \def B{\}}%
882 \def C{\texttt{|}}%
883 \def D{\texttt{\char`\\}}%
884 % \end{macrocode}
885 % \changes{v0.07}{1996/03/15}{macro added}
886 % Need to be careful about writing to table of contents.
887 % \begin{macrocode}
888 \def\addcontentsline##1##2##3{%
889 {\def<{\string<}\def&{\string&}%
890 \addtocontents{##1}{\protect\dotochtml<html>}%
891 \addtocontents{##1}{\protect\contentsline{##2}{##3}{\thepage}}%
892 \addtocontents{##1}{\protect</html>}}}}
893 % \end{macrocode}
894 %
895 % \begin{macro}{\dotochtml}
896 % A `compromise' version of |\dohtml| for use in table of contents
897 % files.
898 % Allows HTML markup |<|, |&| etc, but also \TeX\ markup |\|, |{|, |}|.
899 % As these are incompatible, this is not 100\% reliable but it seems to
900 % cover most cases in practice.
901 % \changes{v0.07}{1996/03/15}{macro added}
902 % \begin{macrocode}
903 \def\dotochtml{%
904 \dohtml
905 \catcode`\\\z@
906 \catcode`\{\@ne
907 \catcode`\}\tw@}
908 % \end{macrocode}
909 % \end{macro}
910 %
911 % \begin{macro}{\SGMLshortend}
912 % \changes{v0.04}{1996/03/09}{macro added}
913 % \begin{macrocode}
914 \def\SGMLshortend{/}
915 % \end{macrocode}
916 % \end{macro}
917 %
918 % \begin{macro}{\SGMLgrab@}
919 % \begin{macrocode}
920 \def\SGMLgrab@#1<#2>{%
921 \edef\@tempd{\lowercase{\def\noexpand\@tempd{\gobblespc#2 \relax}}}%
922 \@tempd
923 % \end{macrocode}
924 %
925 % \changes{v0.04}{1996/03/09}{SHORTTAG support}
926 % \begin{macrocode}
927 \ifx\@tempd\SGMLshortend\let\@tempd\@tempc\fi
928 % \end{macrocode}
929 %
930 % \begin{macrocode}
931 \ifx\@tempb\@tempd
932 \advance\@tempcnta\@ne
933 \else
934 \ifx\@tempc\@tempd
935 \advance\@tempcnta\m@ne
936 \fi
937 \fi
938 \ifnum\@tempcnta=\z@
939 \expandafter\@tempa\expandafter{\the\@temptokena#1}%
940 \else
941 \addto@hook\@temptokena{#1<#2>}%
942 \expandafter\SGMLgrab@
943 \fi}
944 % \end{macrocode}
945 % \end{macro}
946 %
947 % \begin{macro}{\SGMLopen}
948 % \changes{v0.10}{1996/03/25}{Add double quote handling}
949 % \changes{v0.12}{1997/11/29}{delimit with active gtr}
950 % \begin{macrocode}
951 \def\SGMLopen#1>{%
952 \SGMLopen@#1 \@nil}
953 % \end{macrocode}
954 % \end{macro}
955 %
956 % \begin{macrocode}
957 }
958 % \end{macrocode}
959 %
960 % \begin{macro}{\htmlinput}
961 % \begin{macrocode}
962 \def\htmlinput#1{\dohtml\let\@endhtml\relax\input{#1}\endgroup}
963 % \end{macrocode}
964 % \end{macro}
965 %
966 % \begin{macro}{\gobblespc}
967 % \begin{macrocode}
968 \def\gobblespc#1 #2\relax{#1}
969 % \end{macrocode}
970 % \end{macro}
971 %
972 % \begin{macro}{\SGMLgrabber}
973 % \begin{macrocode}
974 \def\SGMLgrabber#1#2{%
975 \def\@tempa{#2}%
976 \@tempcnta\@ne
977 \@temptokena{}%
978 \lowercase{\def\@tempb{#1}\def\@tempc{/#1}}%
979 \SGMLgrab@}
980 % \end{macrocode}
981 % \end{macro}
982 %
983 % \begin{macro}{\SGMLopen@}
984 % \changes{v0.07}{1996/03/15}{macro added}
985 % \begin{macrocode}
986 \begingroup
987 \catcode`\"=\active
988 \uppercase{\endgroup
989 \def\SGMLopen@#1 #2\@nil{%
990 \toks@{}%
991 \edef\@tempa{\lowercase{\def\noexpand\SGMLelement{#1}}}\@tempa
992 \if!\@car#1\relax\@nil
993 \toks@{#1 #2}%
994 \SGML@w{Declaration ignored\MessageBreak<\the\toks@>\MessageBreak}%
995 \else
996 \if$#2$\else
997 \replacequotes#2"\@nil"%
998 \SGMLafterfi
999 \expandafter\toks@\expandafter{\expandafter}%
1000 \expandafter\SGMLgetattrib\the\toks@ \@nil
1001 \fi
1002 \expandafter\ifx\csname SGML@\SGMLelement
1003 \expandafter\endcsname\relax
1004 \SGML@w{<\SGMLelement> undefined}%
1005 \else
1006 \csname SGML@\SGMLelement
1007 \expandafter\expandafter\expandafter\endcsname
1008 \fi
1009 \fi}
1010 % \end{macrocode}
1011 % \end{macro}
1012 %
1013 % \begin{macro}{\replacequotes}
1014 % \begin{macrocode}
1015 \def\replacequotes#1"#2"{%
1016 \def\@tempb{#2}%
1017 \ifx\@tempb\@nnil
1018 \addto@hook\toks@{#1}%
1019 \else
1020 \addto@hook\toks@{#1{#2}}%
1021 \expandafter\replacequotes
1022 \fi}}
1023 % \end{macrocode}
1024 % \end{macro}
1025 %
1026 % \begin{macro}{\SGMLafterfi}
1027 % \begin{macrocode}
1028 \def\SGMLafterfi#1\fi{\fi#1}
1029 % \end{macrocode}
1030 % \end{macro}
1031 %
1032 % \begin{macro}{\SGMLgobbletofi}
1033 % \begin{macrocode}
1034 \def\SGMLgobbletofi#1\fi{\fi}
1035 % \end{macrocode}
1036 % \end{macro}
1037 %
1038 % \begin{macro}{\SGMLgetattrib}
1039 % \changes{v0.10}{1996/03/25}{use dollar to distingish empty value}
1040 % \begin{macrocode}
1041 \def\SGMLgetattrib#1 #2{%
1042 \ifx\box#1\box\else
1043 \SGMLgetval#1=$=\@nil
1044 \def\@tempa{#2}%
1045 \ifx\@tempa\@nnil
1046 \expandafter\SGMLgobbletofi
1047 \else
1048 \expandafter\SGMLafterfi
1049 \fi
1050 \SGMLgetattrib#2%
1051 \fi}
1052 % \end{macrocode}
1053 % \end{macro}
1054 %
1055 % \begin{macro}{\SGMLgetval}
1056 % \changes{v0.08}{1996/03/16}{lowercase attribute names}
1057 % If no value was supplied |#2| will be |$| (Even if the value is |$|
1058 % The test is false, as that would be catcode 13. Done this way rather
1059 % than looking for empty to distinguish |alt=""| with empty value.
1060 % \begin{macrocode}
1061 \def\SGMLgetval#1=#2=#3\@nil{%
1062 \ifcat$#2%
1063 \lowercase{\SGML@addattrib\doimplied{#1}}%
1064 \else
1065 \lowercase{\SGML@addattrib{\do{#1}}}{#2}%
1066 \fi}
1067 % \end{macrocode}
1068 % \end{macro}
1069 %
1070 % \begin{macro}{\SGML@addattrib}
1071 % \changes{v0.08}{1996/03/16}{macro added}
1072 % \begin{macrocode}
1073 \def\SGML@addattrib#1#2{\addto@hook\toks@{#1{#2}}}
1074 % \end{macrocode}
1075 % \end{macro}
1076 %
1077 % \begin{macro}{\SGML@w}
1078 % \begin{macrocode}
1079 \def\SGML@w{\PackageWarning{typehtml}}
1080 % \end{macrocode}
1081 % \end{macro}
1082 %
1083 % \begin{macro}{\SGMLdef}
1084 % \changes{v0.12}{1997/11/29}{allow active delimiters}
1085 % \begin{macrocode}
1086 \def\SGMLdef#1{%
1087 \ifcat\noexpand#1\noexpand~%
1088 \expandafter\SGML@def@active
1089 \else
1090 \expandafter\SGML@def
1091 \fi}
1092 % \end{macrocode}
1093 % \end{macro}
1094 %
1095 % \begin{macro}{\SGMLdef}
1096 % \changes{v0.12}{1997/11/29}{macro added}
1097 % make sure this is a catcode 12 |>|.
1098 % \begin{macrocode}
1099 \edef\@tempa{\def\noexpand\SGML@def##1\string>}\@tempa{%
1100 \expandafter\def\csname SGML@#1\endcsname}
1101 % \end{macrocode}
1102 % \end{macro}
1103 %
1104 % \begin{macro}{\SGMLent}
1105 % \begin{macrocode}
1106 \expandafter\def\expandafter\SGMLent\expandafter{%
1107 \expandafter\protect\csname& \endcsname}
1108 % \end{macrocode}
1109 % \end{macro}
1110 %
1111 % \begin{macro}{& }
1112 % \begin{macrocode}
1113 \expandafter\def\csname& \endcsname{%
1114 \futurelet\@let@token\SGMLent@}
1115 % \end{macrocode}
1116 % \end{macro}
1117 %
1118 % \begin{macro}{\SGMLent@}
1119 % \begin{macrocode}
1120 \def\SGMLent@{%
1121 \ifx\@let@token\@sptoken
1122 \&%
1123 \else
1124 \expandafter\SGMLent@@
1125 \fi}
1126 % \end{macrocode}
1127 % \end{macro}
1128 %
1129 % \begin{macro}{\SGMLentity}
1130 % \begin{macrocode}
1131 \def\SGMLentity#1{%
1132 \expandafter\def\csname SGML@E@#1\endcsname}
1133 % \end{macrocode}
1134 % \end{macro}
1135 %
1136 % \subsection{The HTML2 DTD}
1137 %
1138 % \begin{macrocode}
1139 \SGMLdef<html>{}
1140 \SGMLdef</html>{\@endhtml}
1141 \let\@endhtml\endgroup
1142 % \end{macrocode}
1143 %
1144 % \begin{macrocode}
1145 \SGMLdef<title>{\typeout{***TITLE***}\SGMLgrabber{title}\typeout}
1146 % \end{macrocode}
1147 %
1148 % \begin{macrocode}
1149 \long\def\@tempa#1#2#3#4#5#6{%
1150 \SGMLdef<h1>{\SGMLgrabber{h1}{\HTMLsection{#1}}}%
1151 \SGMLdef<h2>{\SGMLgrabber{h2}{\HTMLsection{#2}}}%
1152 \SGMLdef<h3>{\SGMLgrabber{h3}{\HTMLsection{#3}}}%
1153 \SGMLdef<h4>{\SGMLgrabber{h4}{\HTMLsection{#4}}}%
1154 \SGMLdef<h5>{\SGMLgrabber{h5}{\HTMLsection{#5}}}%
1155 \SGMLdef<h6>{\SGMLgrabber{h6}{\HTMLsection{#6}}}}
1156 % \end{macrocode}
1157 %
1158 % \begin{macrocode}
1159 \expandafter\@tempa\HTML@headings
1160 % \end{macrocode}
1161 %
1162 % \begin{macrocode}
1163 \def\HTMLsection#1#2{#1{\ignorespaces#2\unskip}}
1164 % \end{macrocode}
1165 %
1166 % \begin{macrocode}
1167 \SGMLdef<head>{}
1168 \SGMLdef</head>{}
1169 % \end{macrocode}
1170 %
1171 % \begin{macrocode}
1172 \SGMLdef<body>{}
1173 \SGMLdef</body>{}
1174 % \end{macrocode}
1175 %
1176 % \begin{macrocode}
1177 \SGMLdef<bodytext>{}
1178 \SGMLdef</bodytext>{}
1179 % \end{macrocode}
1180 %
1181 % \begin{macrocode}
1182 \SGMLdef<p>{\par}
1183 \SGMLdef</p>{\par}
1184 % \end{macrocode}
1185 %
1186 % \begin{macrocode}
1187 \SGMLdef<blockquote>{\begin{quote}}
1188 \SGMLdef</blockquote>{\end{quote}}
1189 % \end{macrocode}
1190 %
1191 % \begin{macrocode}
1192 \SGMLdef<address>{\begin{quote}}
1193 \SGMLdef</address>{\end{quote}}
1194 % \end{macrocode}
1195 %
1196 % \begin{macrocode}
1197 \SGMLdef<ul>{\begin{itemize}}
1198 \SGMLdef</ul>{\end{itemize}}
1199 % \end{macrocode}
1200 %
1201 % \begin{macrocode}
1202 \SGMLdef<ol>{\begin{enumerate}}
1203 \SGMLdef</ol>{\end{enumerate}}
1204 % \end{macrocode}
1205 %
1206 % \begin{macrocode}
1207 \SGMLdef<li>{\item}
1208 \SGMLdef</li>{}
1209 % \end{macrocode}
1210 %
1211 % \begin{macrocode}
1212 \SGMLdef<dl>{%
1213 \let\do\dldo
1214 \let\doimplied\dlimplied
1215 \begin{description}\the\toks@}
1216 \SGMLdef</dl>{\end{description}}
1217 % \end{macrocode}
1218 %
1219 % \begin{macrocode}
1220 \def\dldo#1#2{%
1221 \def\@tempa{compact}\def\@tempb{#1}%
1222 \ifx\@tempa\@tempb
1223 \itemsep\z@
1224 \advance\@totalleftmargin-\leftmargin
1225 \advance\linewidth\leftmargin
1226 \itemindent-\labelsep
1227 \leftmargin\z@
1228 \parshape \@ne \@totalleftmargin \linewidth
1229 \fi}
1230 \def\dlimplied#1{\dldo{#1}\relax}
1231 % \end{macrocode}
1232 %
1233 % \begin{macrocode}
1234 \def\itx#1{\item[#1]}
1235 \SGMLdef<dt>{\begin{lrbox}\z@\bfseries\let\maybeenddt\enddt}
1236 \SGMLdef</dt>{\maybeenddt}
1237 \SGMLdef<dd>{\maybeenddt}
1238 \SGMLdef</dd>{}
1239 \def\enddt{\end{lrbox}\item[\unhbox\z@]}
1240 \let\maybeenddt\relax
1241 % \end{macrocode}
1242 %
1243 % \changes{v0.07}{1996/03/15}{hyperref support (SPQR)}
1244 % \begin{macrocode}
1245 \SGMLdef<a>{\SGMLgrabber{a}\HTML@anchor}
1246 % \end{macrocode}
1247 %
1248 % \begin{macro}{\HTML@anchor}
1249 % This handles the A tag.
1250 % \changes{v0.04}{1996/03/09}{macro added}
1251 % \begin{macrocode}
1252 \def\HTML@anchor#1{{%
1253 \let\@tempa\@gobble
1254 \def\_{\string_}%
1255 \let\do\ado
1256 \the\toks@
1257 \@tempa{#1}}}
1258 % \end{macrocode}
1259 % \end{macro}
1260 %
1261 % \begin{macro}{\ado}
1262 % Thanks to SPQR for first pass at integrating \textsf{hyperref}.
1263 % \begin{macrocode}
1264 \def\ado#1#2{%
1265 \def\@tempb{name}\def\@tempc{#1}%
1266 \ifx\@tempb\@tempc
1267 \let\@tempa\@firstofone
1268 \def\@tempa{\HTML@doname{#2}}%
1269 \else
1270 \def\@tempa{\HTML@dosrc{#2}}%
1271 \fi}
1272 % \end{macrocode}
1273 % \end{macro}
1274 %
1275 % \changes{v0.03}{1996/03/08}{pre is alltt not verbatim}
1276 % \begin{macrocode}
1277 \SGMLdef<pre>{%
1278 \par
1279 \begingroup
1280 \parindent\z@
1281 \obeylines\verbatim@font\@noligs
1282 \frenchspacing\@vobeyspaces}
1283 % \end{macrocode}
1284 %
1285 %
1286 % \begin{macrocode}
1287 \SGMLdef</pre>{\endgroup}
1288 % \end{macrocode}
1289 %
1290 % \begin{macrocode}
1291 \SGMLdef<tt>{\SGMLgrabber{tt}\texttt}
1292 \SGMLdef<b>{\SGMLgrabber{b}\textbf}
1293 \SGMLdef<i>{\SGMLgrabber{i}\textit}
1294 \SGMLdef<em>{\SGMLgrabber{em}\emph}
1295 \SGMLdef<strong>{\SGMLgrabber{strong}\textbf}
1296 \SGMLdef<code>{\SGMLgrabber{code}\texttt}
1297 \SGMLdef<samp>{\SGMLgrabber{samp}\textsf}
1298 \SGMLdef<kbd>{\SGMLgrabber{kbd}\texttt}
1299 \SGMLdef<var>{\SGMLgrabber{var}\textit}
1300 \SGMLdef<cite>{\SGMLgrabber{cite}\textit}
1301 % \end{macrocode}
1302 %
1303 % \begin{macrocode}
1304 \SGMLdef<form>{\par\medskip}
1305 \SGMLdef</form>{\par\medskip}
1306 % \end{macrocode}
1307 %
1308 % \begin{macrocode}
1309 \SGMLdef<select>{%
1310 \let\do\selectdo
1311 \the\toks@\par
1312 \begin{tabular}{|l|}%
1313 \hline\@tempc\\\hline
1314 \let\tabularnewline\relax
1315 \ignorespaces}
1316 % \end{macrocode}
1317 %
1318 % \begin{macrocode}
1319 \def\selectdo#1#2{%
1320 \def\@tempa{name}\def\@tempb{#1}%
1321 \ifx\@tempa\@tempb\def\@tempc{#2}\fi}
1322 % \end{macrocode}
1323 %
1324 % \begin{macrocode}
1325 \SGMLdef</select>{\\\hline\end{tabular}}
1326 % \end{macrocode}
1327 %
1328 % \begin{macrocode}
1329 \SGMLdef<option>{%
1330 \gdef\optionbul{\phantom{$\bullet$}}%
1331 \let\do\optiondo
1332 \let\doimplied\optionimplied
1333 \the\toks@
1334 \tabularnewline
1335 \let\tabularnewline\\%
1336 \optionbul\space\ignorespaces}
1337 \SGMLdef</option>{}
1338 % \end{macrocode}
1339 %
1340 % \begin{macro}{\optiondo}
1341 % Handle attributes to the OPTION element.
1342 % \begin{macrocode}
1343 \def\optiondo#1#2{%
1344 \def\@tempa{selected}\def\@tempb{#1}%
1345 \ifx\@tempa\@tempb\gdef\optionbul{$\bullet$}\fi}
1346 % \end{macrocode}
1347 % \end{macro}
1348 %
1349 % \begin{macro}{\optionimplied}
1350 % Handle the case where just the attribute value is given.
1351 % \begin{macrocode}
1352 \def\optionimplied#1{%
1353 \def\@tempa{selected}\def\@tempb{#1}%
1354 \ifx\@tempa\@tempb\gdef\optionbul{$\bullet$}\fi}
1355 % \end{macrocode}
1356 % \end{macro}
1357 %
1358 % \begin{macrocode}
1359 \SGMLdef<input>{}
1360 % \end{macrocode}
1361 %
1362 % \begin{macrocode}
1363 \SGMLdef<img>{{%
1364 \let\do\imgdo
1365 \def\@tempa{\doimage}%
1366 \the\toks@
1367 \@tempa}}
1368 % \end{macrocode}
1369 %
1370 % \begin{macrocode}
1371 \def\doimage{\textsf{[image]}}
1372 % \end{macrocode}
1373 %
1374 % \begin{macro}{\imgdo}
1375 % Handle IMG attributes (not very usefully)
1376 % \begin{macrocode}
1377 \def\imgdo#1{\csname img=#1\endcsname}
1378 \expandafter\def\csname img=align\endcsname#1{%
1379 \SGML@w{align=#1 ignored}}
1380 \expandafter\def\csname img=src\endcsname#1{%
1381 \SGML@w{src=#1 ignored}}
1382 \expandafter\def\csname img=height\endcsname#1{%
1383 \SGML@w{height=#1 ignored}}
1384 \expandafter\def\csname img=alt\endcsname#1{%
1385 \def\doimage{#1}}
1386 % \end{macrocode}
1387 % \end{macro}
1388 %
1389 % Horizontal rules and line breaks.
1390 % \changes{v0.12}{1997/11/29}{BR in vertical mode allowed.}
1391 % \begin{macrocode}
1392 \SGMLdef<hr>{\par\smallskip\hrule\smallskip}
1393 \SGMLdef<br>{\leavevmode\\}
1394 % \end{macrocode}
1395 %
1396 % These are obsolete in HTML3 but do them anyway.
1397 % \changes{v0.10}{1996/03/25}{XMP and LISTING and PLAINTEXT added}
1398 % \begin{macrocode}
1399 \SGMLdef<xmp>{%
1400 \SGML@pre
1401 \def\@tempb{/xmp}%
1402 \let\SGMLopen\HTML@xmptest}
1403 % \end{macrocode}
1404 %
1405 % \begin{macrocode}
1406 \SGMLdef<listing>{%
1407 \SGML@xmp
1408 \def\@tempb{/listing}}
1409 % \end{macrocode}
1410 %
1411 % \begin{macrocode}
1412 \SGMLdef<plaintext>{%
1413 \SGML@xmp
1414 \def\@tempb{/plaintext}}%
1415 % \end{macrocode}
1416 %
1417 % \begin{macro}{\HTML@xmptest}
1418 % \begin{macrocode}
1419 \def\HTML@xmptest#1>{%
1420 \lowercase{\def\@tempa{#1}}%
1421 \ifx\@tempa\@tempb
1422 \endgroup
1423 \else
1424 \SGMLafterfi
1425 <#1>%
1426 \fi}
1427 % \end{macrocode}
1428 % \end{macro}
1429 %
1430 %
1431 % SGML syntax Character entities.
1432 % \begin{macrocode}
1433 \SGMLentity{amp}{\&}
1434 \SGMLentity{lt}{\ensuremath{<}}
1435 \SGMLentity{gt}{\ensuremath{>}}
1436 % \end{macrocode}
1437 %
1438 % ISO Latin-1 Character entities.
1439 % \begin{macrocode}
1440 \SGMLentity{aacute}{\'a}
1441 \SGMLentity{Aacute}\'A{}
1442 \SGMLentity{acirc}{\^a}
1443 \SGMLentity{Acirc}{\^A}
1444 \SGMLentity{agrave}{\`a}
1445 \SGMLentity{Agrave}{\`A}
1446 \SGMLentity{aring}{\r a}
1447 \SGMLentity{Aring}{\r A}
1448 \SGMLentity{atilde}{\~a}
1449 \SGMLentity{Atilde}{\~A}
1450 \SGMLentity{auml}{\"a}
1451 \SGMLentity{Auml}{\"A}
1452 \SGMLentity{aelig}{\ae}
1453 \SGMLentity{AElig}{\AE}
1454 \SGMLentity{ccedil}{\c c}
1455 \SGMLentity{Ccedil}{\c C}
1456 \SGMLentity{eth}{\dh}
1457 \SGMLentity{ETH}{\DH}
1458 \SGMLentity{eacute}{\'e}
1459 \SGMLentity{Eacute}{\`E}
1460 \SGMLentity{ecirc}{\^e}
1461 \SGMLentity{Ecirc}{\^E}
1462 \SGMLentity{egrave}{\`e}
1463 \SGMLentity{Egrave}{\`E}
1464 \SGMLentity{euml}{\"e}
1465 \SGMLentity{Euml}{\"E}
1466 \SGMLentity{iacute}{\'\i}
1467 \SGMLentity{Iacute}{\'I}
1468 \SGMLentity{icirc}{\^\i}
1469 \SGMLentity{Icirc}{\^I}
1470 \SGMLentity{igrave}{\`\i}
1471 \SGMLentity{Igrave}{\`I}
1472 \SGMLentity{iuml}{\"\i}
1473 \SGMLentity{Iuml}{\"I}
1474 \SGMLentity{ntilde}{\~n}
1475 \SGMLentity{Ntilde}{\~N}
1476 \SGMLentity{oacute}{\'o}
1477 \SGMLentity{Oacute}{\'O}
1478 \SGMLentity{ocirc}{\^o}
1479 \SGMLentity{Ocirc}{\^O}
1480 \SGMLentity{ograve}{\`o}
1481 \SGMLentity{Ograve}{\`O}
1482 \SGMLentity{oslash}{\oe}
1483 \SGMLentity{Oslash}{\OE}
1484 \SGMLentity{otilde}{\~o}
1485 \SGMLentity{Otilde}{\~O}
1486 \SGMLentity{ouml}{\"o}
1487 \SGMLentity{Ouml}{\"O}
1488 \SGMLentity{szlig}{\ss}
1489 \SGMLentity{thorn}{\th}
1490 \SGMLentity{THORN}{\TH}
1491 \SGMLentity{uacute}{\'u}
1492 \SGMLentity{Uacute}{\'U}
1493 \SGMLentity{ucirc}{\^u}
1494 \SGMLentity{Ucirc}{\^U}
1495 \SGMLentity{ugrave}{\`u}
1496 \SGMLentity{Ugrave}{\`U}
1497 \SGMLentity{uuml}{\"u}
1498 \SGMLentity{Uuml}{\"U}
1499 \SGMLentity{yacute}{\'y}
1500 \SGMLentity{Yacute}{\'Y}
1501 \SGMLentity{yuml}{\"y}
1502 % \end{macrocode}
1503 %
1504 % \subsection{Netscape Non-HTML tags}
1505 %
1506 % Netscape allows certain tags that do not correspond to HTML elements.
1507 % These are \emph{Bad Thing}. Originally the documentation of this
1508 % package stated that such `extensions' would not be supported, however
1509 % as a request came from \ldots\ldots\footnote{Name withheld to
1510 % protect the guilty} who also supplied most of the code in this
1511 % section (and also the table section), I have added some support
1512 % which is enabled if the \texttt{netscape} option is used.
1513 % \begin{macrocode}
1514 \ifx\HTML@not\@undefined\else
1515 % \end{macrocode}
1516 %
1517 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1518 % Do something with bad reprehensible nonstandard tags
1519 % that have the annoying habit of turning up often in html files that
1520 % I want to print. [mjd,1996/03/20]
1521 %
1522 % |\HTML@not| is defined above in the netscape option:
1523 % Naughty Nonstandard Extension Warning for things like
1524 % |<center>| and |<font>|. (I thought these were
1525 % Netscape-specific but the technical notes at Spyglass's web site
1526 % showed that I was wrong. [mjd,1996/03/20])
1527 % \begin{macrocode}
1528 \SGMLdef<center>{\HTML@not{center}\begin{center}}
1529 \SGMLdef</center>{\end{center}}
1530 % \end{macrocode}
1531 %
1532 % \begin{macrocode}
1533 \SGMLdef<blink>{\SGMLgrabber{blink}\textbf}
1534 % \end{macrocode}
1535 %
1536 % \begin{macrocode}
1537 \SGMLdef<font>{\HTML@not{font}\begingroup
1538 \let\do\fontdo\the\toks@}
1539 \SGMLdef</font>{\endgroup}
1540 % \end{macrocode}
1541 % |\fontdo| must look at the first character of the `size, value to see
1542 % if it is a relative size change (|+| or |-|). Otherwise it is an
1543 % absolute size change.
1544 % \begin{macrocode}
1545 \def\fontdo#1#2{%
1546 \def\@tempa{size}\def\@tempb{#1}%
1547 \ifx\@tempa\@tempb
1548 \font@switch#2\relax\@nil
1549 \fi}
1550 % \end{macrocode}
1551 %
1552 % Let's hack a nice little hook into |\@setfontsize| (tsk tsk).
1553 % If we can set the current font size number there, it makes the rest
1554 % of the job much easier.
1555 % \begin{macrocode}
1556 \toks@\expandafter{\set@fontsize{#1}{#2}{#3}}
1557 \edef\@tempa{%
1558 \def\noexpand\set@fontsize##1##2##3{\the\toks@\noexpand\set@fontnum}}
1559 \@tempa
1560 % \end{macrocode}
1561 %
1562 % Take |\f@size| which is a real number, convert it to an integer,
1563 % and normalize to the desired range.
1564 % \begin{macrocode}
1565 \def\set@fontnum{\dimen@\f@size\p@
1566 \dimen@\mul@ptsize\dimen@
1567 \count@\dimen@ \divide\count@\p@
1568 \advance\count@ -5\relax
1569 \edef\@fontnum{\number\count@}}
1570 % \end{macrocode}
1571 %
1572 % Nice consistent naming conventions as always.
1573 % multiplier if 11pt or 12pt documentclass option is used
1574 % \begin{macrocode}
1575 \def\mul@ptsize{}%
1576 % \end{macrocode}
1577 %
1578 % 5 = |\normalsize| I think
1579 % \begin{macrocode}
1580 \def\@fontnum{5}
1581 % \end{macrocode}
1582 %
1583 % Initialize |\mul@ptsize|
1584 % \begin{macrocode}
1585 \ifcase 0\@ptsize\relax
1586 \global\let\mul@ptsize\@empty% case 0, ptsize = 10
1587 \or\gdef\mul@ptsize{.9091}% case 1, ptsize = 11
1588 \else\gdef\mul@ptsize{.8333}% case 2, ptsize = 12
1589 \fi
1590 % \end{macrocode}
1591 %
1592 % |\font@switch| looks for |+| or |-| and selects a suitable fontsize
1593 % command.
1594 % \begin{macrocode}
1595 \def\font@switch#1#2\@nil{\count@\@fontnum\relax
1596 \ifx +#1\advance\else\ifx -#1\advance\fi\fi
1597 \count@#1#2\relax
1598 \ifcase\count@ \tiny\or \tiny\or \scriptsize
1599 \or\footnotesize \or\small \or\normalsize \or\large
1600 \or\Large \or\LARGE \or\huge \else\Huge \fi}
1601 % \end{macrocode}
1602 %
1603 % \begin{macrocode}
1604 \fi
1605 % \end{macrocode}
1606 %
1607 % \subsection{The HTML3 DTD}
1608 %
1609 % |\HTML@two@stop| is |\endinput| (and so the package stops here)
1610 % unless the HTML3 option is given.
1611 % \begin{macrocode}
1612 \HTML@two@stop
1613 \SGML@w{HTML3 support not finished yet}
1614 % \end{macrocode}
1615 %
1616 % \begin{macrocode}
1617 \SGMLdef<math>{\SGMLgrabber{math}\domath}
1618 % \end{macrocode}
1619 %
1620 % \begin{macrocode}
1621 \SGMLdef<sup>{^\bgroup\HTMLscriptmap}
1622 \SGMLdef</sup>{\egroup}
1623 % \end{macrocode}
1624 %
1625 % \begin{macrocode}
1626 \SGMLdef<sub>{_\bgroup\HTMLscriptmap}
1627 \SGMLdef</sub>{\egroup}
1628 % \end{macrocode}
1629 %
1630 % GRUMBLE! GRUMBLE! GRUMBLE! Possibly the worst feature of \TeX's math
1631 % markup is the nature of the infix operators for fractions and the
1632 % like. And here it is faithfully (or actually not very faithfully)
1633 % reconstructed here\ldots
1634 % \begin{macrocode}
1635 \SGMLdef<box>{\SGMLgrabber{box}\dobox}
1636 % \end{macrocode}
1637 %
1638 % \begin{macrocode}
1639 \begingroup
1640 \catcode`\<=\active
1641 \catcode`\>=\active
1642 \catcode`\&=\active
1643 \catcode`\_=\active
1644 \catcode`\^=\active
1645 \catcode`\"=\active
1646 % \end{macrocode}
1647 %
1648 % \begin{macro}{\domath}
1649 % Handle the MATH element. The body is pre-expanded one level to
1650 % replace |{ }| by BOX elements, and to replace any SGML entitity
1651 % references by single \TeX\ tokens so they can be recognised more
1652 % easily. Then start math mode with |\[| (which may have been
1653 % redefined locally if the BOX attribute was used) set up the
1654 % shorteref map.
1655 % \begin{macrocode}
1656 \gdef\domath#1{%
1657 {{\def&{\expandafter\expandafter\expandafter\noexpand\SGMLent@@}%
1658 \let<\relax\let>\relax\let_\relax\let^\relax\let"\relax
1659 \def\{{<box>}\def\}{</box>}%
1660 \xdef\@gtempa{#1}}%
1661 \let\do\mathdo
1662 \let\doimplied\mathimplied
1663 \the\toks@
1664 \[%
1665 \m@th\nulldelimiterspace\z@
1666 \def^{<sup>}%
1667 \def_{<sub>}%
1668 \@gtempa\]}}
1669 % \end{macrocode}
1670 % \end{macro}
1671 %
1672 % \begin{macro}{\HTMLscriptmap}
1673 % Set up the shortref map used in super and subscripts.
1674 % \begin{macrocode}
1675 \gdef\HTMLscriptmap{%
1676 \def^{</sup>}%
1677 \def_{</sub>}}
1678 % \end{macrocode}
1679 % \end{macro}
1680 %
1681 % \begin{macro}{\dobox}
1682 % Handle the BOX element.
1683 % First deal with the attributes, then set up the shortref map. Then
1684 % start looking for a LEFT tag.
1685 % \begin{macrocode}
1686 \gdef\dobox#1{%
1687 {\let\do\boxdo
1688 \let\bigstrut\relax
1689 \the\toks@
1690 \def^{<sup>}%
1691 \def_{<sub>}%
1692 \lookleft@#1<left>\@nil}}
1693 % \end{macrocode}
1694 % \end{macro}
1695 %
1696 % \begin{macro}{\lookleft@}
1697 % See whether this BOX element contains a LEFT tag. Supply a `null
1698 % delimiter' if not one supplied.
1699 % \begin{macrocode}
1700 \gdef\lookleft@#1<left>#2\@nil{%
1701 \if$#2$%
1702 {\left.\bgroup#1\mayberight}%
1703 \else
1704 \lookbox@#1<box>\@nil#2\@nil
1705 \fi}
1706 % \end{macrocode}
1707 % \end{macro}
1708 %
1709 % \begin{macro}{\lookbox@}
1710 % Having found a LEFT tag, need to check it isn't inside a nested BOX.
1711 % The following code looks for an explicit |<BOX>| (which includes a
1712 % |{| shortref as that will have been expanded by now, however it will
1713 % fail if nested boxes have attributes, so it may need some further
1714 % modifications later.
1715 % \begin{macrocode}
1716 \gdef\lookbox@#1<box>#2\@nil#3<left>\@nil{%
1717 \if$#2$%
1718 {\maybeleft#1\@nil#3\mayberight}
1719 \else
1720 {#1 \boxtofront#2 <left> #3}%
1721 \fi}
1722 % \end{macrocode}
1723 % \end{macro}
1724 %
1725 % \begin{macro}{\boxtofront}
1726 % After all that messing around need to put the BOX tag back where we
1727 % found it.
1728 % \begin{macrocode}
1729 \gdef\boxtofront#1<box>{<box>#1}
1730 % \end{macrocode}
1731 % \end{macro}
1732 %
1733 % \begin{macrocode}
1734 \endgroup
1735 % \end{macrocode}
1736 %
1737 % \begin{macro}{\mathdo}
1738 % \changes{v0.04}{1996/03/10}{Support math attributes}
1739 % \begin{macrocode}
1740 \def\mathdo#1#2{%
1741 \def\@tempa{class-chem}\def\@tempb{#1-#2}%
1742 \ifx\@tempa\@tempb
1743 \everymath{\fam\z@}\everydisplay{\fam\z@}%
1744 \fi}
1745 \def\mathimplied#1{%
1746 \def\@tempa{box}\def\@tempb{#1}%
1747 \ifx\@tempa\@tempb
1748 \def\[{\center\setbox\z@\hbox\bgroup$\displaystyle}%
1749 \def\]{$\egroup\fbox{\box\z@}\endcenter}%
1750 \fi}
1751 % \end{macrocode}
1752 % \end{macro}
1753 %
1754 % \begin{macro}{\boxdo}
1755 % \changes{v0.04}{1996/03/09}{Support box size attribute}
1756 % \begin{macrocode}
1757 \def\boxdo#1#2{%
1758 \def\@tempa{size}\def\@tempb{#1}%
1759 \ifx\@tempa\@tempb
1760 \def\@tempb{#2}
1761 \def\@tempa{normal}\ifx\@tempa\@tempb\def\@tempc{1}\fi
1762 \def\@tempa{medium}\ifx\@tempa\@tempb\def\@tempc{2}\fi
1763 \def\@tempa{large}\ifx\@tempa\@tempb\def\@tempc{3}\fi
1764 \def\@tempa{huge}\ifx\@tempa\@tempb\def\@tempc{4}\fi
1765 \edef\bigstrut{\vrule\@height\@tempc\ht\strutbox\@width\z@}
1766 \fi}
1767 % \end{macrocode}
1768 % \end{macro}
1769 %
1770 % \begin{macro}{\SGML@left}
1771 % \begin{macrocode}
1772 \SGMLdef<left>{\left.\bgroup}
1773 % \end{macrocode}
1774 % \end{macro}
1775 %
1776 % \begin{macro}{\mayberight}
1777 % \begin{macrocode}
1778 \def\mayberight{\egroup\bigstrut\right.}
1779 % \end{macrocode}
1780 % \end{macro}
1781 %
1782 % \begin{macro}{\maybeleft}
1783 % \changes{v0.04}{1996/03/09}{macro added}
1784 % \begin{macrocode}
1785 \def\maybeleft#1#2\@nil{%
1786 \in@{#1}{()[]\SGML@E@rbrace\SGML@E@lbrace}%
1787 \ifin@
1788 \left#1\bgroup#2%
1789 \else
1790 \let\SGML@E@int\HTML@bigint
1791 #1#2\left.\bgroup\let\SGML@E@int\int
1792 \fi}
1793 % \end{macrocode}
1794 % \end{macro}
1795 %
1796 % \begin{macro}{\righttest}
1797 % \changes{v0.04}{1996/03/09}{macro added}
1798 % \begin{macrocode}
1799 \def\righttest#1{%
1800 \in@{#1}{()[]\SGML@E@rbrace\SGML@E@lbrace}%
1801 \ifin@
1802 \right#1\let\mayberight\relax
1803 \else
1804 \right.\let\mayberight\relax\expandafter#1%
1805 \fi}
1806 % \end{macrocode}
1807 % \end{macro}
1808 %
1809 % \subsection{`Big int' processing}
1810 % I am not sure that stretchy integral signs are good idea in general,
1811 % and certainly they do not fit well with the Computer Modern style of
1812 % sloping integral sign as opposed to the more vertical style of, say,
1813 % Lucida. However\ldots
1814 %
1815 % \begin{macro}{\HTML@int}
1816 % \changes{v0.04}{1996/03/010}{macro added}
1817 % \begin{macrocode}
1818 \ifx\HTML@int\@undefined
1819 % \end{macrocode}
1820 %
1821 % \begin{macro}{\HTML@bigint}
1822 % Normally just use the standard |\int|.
1823 % \begin{macrocode}
1824 \let\HTML@bigint\int
1825 % \end{macrocode}
1826 %
1827 % \begin{macrocode}
1828 \else
1829 % \end{macrocode}
1830 %
1831 % With the |bigint| option .
1832 % The original |\int| (in a big font) together with any saved limits
1833 % (in the normal font).
1834 % \begin{macrocode}
1835 \def\HTML@int{\int^{\box\tw@}_{\box4}}
1836 % \end{macrocode}
1837 % \end{macro}
1838 %
1839 % \begin{macro}{\HTML@bigint}
1840 % \begin{macrocode}
1841 \def\HTML@bigint#1\left.\bgroup{%
1842 \def\@tempa{#1}%
1843 \setbox\z@\hbox\bgroup
1844 \aftergroup\HTMLafterbigint$\displaystyle\bgroup
1845 \aftergroup$\aftergroup\egroup}
1846 % \end{macrocode}
1847 % \end{macro}
1848 %
1849 % \begin{macro}{\HTMLafterbigint}
1850 % \begin{macrocode}
1851 \def\HTMLafterbigint{%
1852 \dimen@.5\ht\z@
1853 \advance\dimen@.5\dp\z@
1854 {\SGMLdef<sup>{\setbox\tw@\hbox\bgroup\HTMLscriptmap$\scriptstyle}%
1855 \SGMLdef<sub>{\setbox4\hbox\bgroup\HTMLscriptmap$\scriptstyle}%
1856 \SGMLdef</sup>{$\egroup}%
1857 \SGMLdef</sub>{$\egroup}%
1858 \setbox\tw@\box\voidb@x
1859 \setbox4\box\voidb@x
1860 \@tempa
1861 \ifdim\dimen@>\f@size\p@
1862 % \end{macrocode}
1863 % At this point, could do |\fontsize\dimen@\z@\selectfont| but that
1864 % would load \emph{all} the math fonnts at a strange size, so instead
1865 % just load the extension font, and then subvert NFSS to drop that
1866 % into the math expression. The NFSS interface is still used to
1867 % declare the font so that a size substitution is done on the loading
1868 % (otherwise every integral may use up a new font).
1869 % \changes{v0.08}{1996/03/16}{Use \cs{DeclareFixedFont}}
1870 % \begin{macrocode}
1871 \mathop{\hbox{\DeclareFixedFont\@tempa{OMX}{cmex}{m}{n}\dimen@
1872 $\displaystyle\textfont\thr@@\@tempa\HTML@int$}}%
1873 \else
1874 \HTML@int
1875 \fi
1876 }\left.\box\z@}
1877 % \end{macrocode}
1878 % \end{macro}
1879 %
1880 % \begin{macrocode}
1881 \fi
1882 % \end{macrocode}
1883 % \end{macro}
1884 %
1885 %
1886 % See above grumble. The HTML3 DTD comments specifically refer to
1887 % these as `\LaTeX\ commands' but they are no such thing. They are in
1888 % plain and survive into \LaTeX\ under protest! The AMS \LaTeX\
1889 % documentation contains a much longer diatribe against these infix
1890 % commands, and they are \emph{disabled} in the AMS \LaTeX\ styles.
1891 % \begin{macrocode}
1892 \SGMLdef<over>{\over}
1893 \SGMLdef<atop>{\atop}
1894 \SGMLdef<choose>{\choose}
1895 % \end{macrocode}
1896 %
1897 % \begin{macrocode}
1898 \SGMLdef<right>{\egroup\bigstrut\righttest}
1899 % \end{macrocode}
1900 %
1901 % \begin{macrocode}
1902 \SGMLdef<above>{\SGMLgrabber{above}%
1903 {\let\@tempc\overlineop
1904 \let\do\abovedo
1905 \the\toks@
1906 \@tempc}}
1907 % \end{macrocode}
1908 %
1909 % \begin{macrocode}
1910 \SGMLdef<below>{\SGMLgrabber{below}%
1911 {\let\@tempc\underlineop
1912 \let\do\abovedo
1913 \the\toks@
1914 \@tempc}}
1915 % \end{macrocode}
1916 %
1917 % \begin{macrocode}
1918 \def\overlineop#1{\mathop{\overline{#1}}}
1919 \def\underlineop#1{\mathop{\underline{#1}}}
1920 % \end{macrocode}
1921 %
1922 % \begin{macrocode}
1923 \def\abovedo#1#2{%
1924 \def\@tempa{sym}\def\@tempb{#1}%
1925 \ifx\@tempa\@tempb\def\@tempc{\csname#2\endcsname}\fi}
1926 % \end{macrocode}
1927 %
1928 % \begin{macrocode}
1929 \SGMLdef<vec>{\SGMLgrabber{vec}\vec}
1930 \SGMLdef<bar>{\SGMLgrabber{bar}\bar}
1931 \SGMLdef<dot>{\SGMLgrabber{dot}\dot}
1932 \SGMLdef<ddot>{\SGMLgrabber{ddot}\ddot}
1933 \SGMLdef<hat>{\SGMLgrabber{hat}\hat}
1934 \SGMLdef<tilde>{\SGMLgrabber{tilde}\tilde}
1935 % \end{macrocode}
1936 %
1937 % \begin{macrocode}
1938 \SGMLdef<t>{\SGMLgrabber{t}\mathrm}
1939 \SGMLdef<bt>{\SGMLgrabber{bt}\mathbf}
1940 % \end{macrocode}
1941 %
1942 % \begin{macrocode}
1943 \SGMLdef<text>{\SGMLgrabber{text}\textnormal}%%%%% not in the dtd????
1944 % \end{macrocode}
1945 %
1946 % \begin{macrocode}
1947 \SGMLdef<root>{\rootfudge}
1948 \def\rootfudge#1{%
1949 \setbox\rootbox\hbox\bgroup$\m@th\scriptscriptstyle\bgroup#1}
1950 % \end{macrocode}
1951 %
1952 % I think the HTML3 DTD is wrong here\footnote
1953 % {Since confirmed by Dave Raggett, the HTML3 author},
1954 % it allows the OF element to
1955 % take content, which is at variance with the description in the text.
1956 % \begin{macrocode}
1957 \SGMLdef<of>{\egroup$\egroup\SGMLgrabber{root}\offudge}
1958 \SGMLdef</of>{}
1959 \def\offudge#1{\mathpalette\r@@t{#1}}
1960 % \end{macrocode}
1961 %
1962 % \begin{macrocode}
1963 \SGMLdef<sqrt>{\SGMLgrabber{sqrt}\sqrt}
1964 % \end{macrocode}
1965 %
1966 % \changes{v0.08}{1996/03/16}{Add basic support for array element}
1967 %
1968 % Hate allocating registers, so this will probably go, but for now
1969 % give myself four (global) count registers to play with.
1970 % \begin{macrocode}
1971 \newcount\HTMLrow
1972 \newcount\HTMLcol
1973 \newcount\HTMLrowspan
1974 \newcount\HTMLcolspan
1975 % \end{macrocode}
1976 %
1977 % The HTML array element. Support for ALIGN, COLSPAN, ROWSPAN
1978 % LABELS, LDELIM and RDELIM. However not all combinations of alignment
1979 % and labels do `the right thing'.
1980 %
1981 % \changes{v0.09}{1996/03/21}{COLSPEC support for ARRAY}
1982 %
1983 % Uses a \TeX\ primitive |\halign| construction, rather than use the
1984 % \LaTeX\ |array| environment directly.
1985 % \begin{macrocode}
1986 \SGMLdef<array>{{\ifnum`}=0\fi
1987 \let\do\arraydo
1988 \let\doimplied\arrayimplied
1989 \let\HTMLal.%
1990 \let\HTMLar.%
1991 \global\HTMLrow\z@
1992 \let\HTMLabox\vcenter
1993 \the\toks@
1994 \setbox\z@\vbox\bgroup\halign\bgroup
1995 \strut\span\HTMLacolspec\cr\nocr}
1996 % \end{macrocode}
1997 %
1998 % \begin{macro}{\HTMLacolspec}
1999 % \changes{v0.09}{1996/03/21}{macro added}
2000 % \begin{macrocode}
2001 \def\HTMLacolspec{##&&##}
2002 % \end{macrocode}
2003 % \end{macro}
2004 %
2005
2006 % \begin{macro}{\HTMLamakepream}
2007 % \changes{v0.09}{1996/03/21}{macro added}
2008 % \begin{macrocode}
2009 \def\HTMLamakepream#1{%
2010 \let\HTMLacolspec\@empty
2011 \let\@sharp\relax
2012 \lowercase{\@tfor\@tempc:=#1}\do{%
2013 \if\@tempc l%
2014 \edef\HTMLacolspec{\HTMLacolspec\@sharp\hfill&}%
2015 \else
2016 \if\@tempc c%
2017 \edef\HTMLacolspec{\HTMLacolspec\hfill\@sharp\hfill&}%
2018 \else
2019 \if\@tempc r%
2020 \edef\HTMLacolspec{\HTMLacolspec\hfill\@sharp&}%
2021 \else
2022 \if\@tempc +%
2023 \edef\HTMLacolspec{\HTMLacolspec$+$}%
2024 \else
2025 \if\@tempc -%
2026 \edef\HTMLacolspec{\HTMLacolspec$-$}%
2027 \else
2028 \if\@tempc =%
2029 \edef\HTMLacolspec{\HTMLacolspec$=$}%
2030 \fi
2031 \fi
2032 \fi
2033 \fi
2034 \fi
2035 \fi}%
2036 \def\@sharp{########}%
2037 \edef\HTMLacolspec{\HTMLacolspec&\@sharp}}
2038 % \end{macrocode}
2039 % \end{macro}
2040 %
2041 % \begin{macrocode}
2042 \SGMLdef</array>{\HTMLendarray}
2043 % \end{macrocode}
2044 %
2045 % \begin{macrocode}
2046 \let\HTMLcr\cr
2047 % \end{macrocode}
2048 %
2049 % \begin{macro}{\HTMLendarray}
2050 % Non LABELS ending
2051 % \begin{macrocode}
2052 \def\HTMLendarray{%
2053 \endi\crcr\egroup\egroup
2054 \ifx\HTMLabox\vtop
2055 \setbox\z@\vtop{\unvbox\z@}%
2056 \else
2057 \ifx\HTMLabox\vcenter
2058 \dimen@\ht\z@
2059 \advance\dimen@\dp\z@
2060 \divide\dimen@\tw@
2061 \advance\dimen@-\ht\z@
2062 \setbox\z@\hbox{\raise\dimen@\box\z@}%
2063 \fi
2064 \fi
2065 \dimen@=\ht\z@
2066 \setbox\z@
2067 \hbox{$\left\HTMLal\kern-1em\vcenter{\box\z@}\kern-1em\right\HTMLar$}%
2068 \advance\dimen@-\ht\z@
2069 \raise\dimen@\box\z@
2070 \ifnum`{=0\fi}}
2071 % \end{macrocode}
2072 % \end{macro}
2073 %
2074 % \begin{macro}{\HTMLendarraylabels}
2075 % LABELS ending
2076 % \begin{macrocode}
2077 \def\HTMLendarraylabels{%
2078 \endi\crcr\strut\cr\egroup\egroup
2079 \setbox2=\vsplit\z@ to \baselineskip
2080 \setbox\z@\vbox{\unvbox\z@\global\setbox\@ne\lastbox}%
2081 \setbox4\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
2082 \vcenter{%
2083 \box2
2084 \hbox{$\kern\wd\@ne
2085 \left\HTMLal\kern-\wd\@ne
2086 \vcenter{\box\z@}%
2087 \right\HTMLar$}}%
2088 \ifnum`{=0\fi}}
2089 % \end{macrocode}
2090 % \end{macro}
2091 %
2092 % \begin{macrocode}
2093 \def\nocr{\relax\iffalse{\fi\let\HTMLcr\relax\iffalse}\fi}
2094 % \end{macrocode}
2095 %
2096 % \begin{macrocode}
2097 \SGMLdef<row>{%
2098 \endi\HTMLcr
2099 \global\advance\HTMLrow\@ne
2100 \global\HTMLcol\z@}
2101 % \end{macrocode}
2102 %
2103 % \begin{macrocode}
2104 \SGMLdef</row>{}
2105 % \end{macrocode}
2106 %
2107 % \begin{macrocode}
2108 \SGMLdef<item>{%
2109 \let\do\itemdo
2110 \gdef\@gtempa{\global\advance\HTMLcol\@ne}%
2111 \gdef\@gtempb{}%
2112 \gdef\@gtempc{}%
2113 \global\HTMLcolspan\@ne
2114 \the\toks@
2115 \endi%
2116 \@gtempc
2117 \@gtempa
2118 % \end{macrocode}
2119 %
2120 % If an earlier row contained an entry spanning down to this point,
2121 % need to jump across to the next column (and perhaps further).
2122 % \begin{macrocode}
2123 \spanifneeded
2124 % \end{macrocode}
2125 %
2126 % |\@gtempb| is normally empty but will be defined if the item had an
2127 % ALIGN attribute.
2128 % \begin{macrocode}
2129 \@gtempb
2130 % \end{macrocode}
2131 % First box each entry which allows measuring needed (but not yet
2132 % done) for vertical spanning.
2133 % \begin{macrocode}
2134 \setbox\z@\hbox\bgroup$%
2135 \def\endi{\unskip$\egroup%
2136 \quad\HTMLaleft\box\z@\HTMLaright\quad&}%
2137 \ignorespaces}
2138 % \end{macrocode}
2139 %
2140 % \begin{macro}{\spanifneeded}
2141 % If the current row/column is in the list of spanned entries, jump to
2142 % next column and look again.
2143 % \begin{macrocode}
2144 \def\spanifneeded{%
2145 \edef\@tempa{\noexpand\in@{,\the\HTMLrow/\the\HTMLcol,}{\spanitems}}%
2146 \@tempa
2147 \ifin@
2148 \@firstofone{&}\global\advance\HTMLcol\@ne
2149 \expandafter\spanifneeded
2150 \fi}
2151 % \end{macrocode}
2152 % \end{macro}
2153 %
2154 % As usual handle end tags that may be omitted by making them
2155 % translate to empty.
2156 % \begin{macrocode}
2157 \SGMLdef</item>{}
2158 % \end{macrocode}
2159 %
2160 % \begin{macro}{\HTMLaleft}
2161 % \begin{macro}{\HTMLaright}
2162 % Default stuff to put around the entries. Locally redefined by an
2163 % ALIGN attribute.
2164 % \begin{macrocode}
2165 \let\HTMLaleft\hfil
2166 \let\HTMLaright\hfil
2167 % \end{macrocode}
2168 % \end{macro}
2169 % \end{macro}
2170 %
2171 % \begin{macro}{\endi}
2172 % Code to end an item. Extra indirection used to handle omitted tags.
2173 % \begin{macrocode}
2174 \let\endi\relax
2175 % \end{macrocode}
2176 % \end{macro}
2177 %
2178 % \begin{macro}{\arraydo}
2179 % \changes{v0.09}{1996/03/21}{COLSPEC added}
2180 % Handle ARRAY attributes.
2181 % \begin{macrocode}
2182 \def\arraydo#1#2{%
2183 \def\@tempa{#1}\def\@tempb{#2}%
2184 \def\@tempc{align}%
2185 \ifx\@tempa\@tempc
2186 \def\@tempc{top}%
2187 \ifx\@tempb\@tempc
2188 \let\HTMLabox\vtop
2189 \else
2190 \def\@tempc{bottom}%
2191 \ifx\@tempb\@tempc
2192 \let\HTMLabox\vbox
2193 \fi
2194 \fi
2195 \else
2196 \def\@tempc{ldelim}%
2197 \ifx\@tempa\@tempc
2198 \let\HTMLal\@tempb
2199 \else
2200 \def\@tempc{rdelim}%
2201 \ifx\@tempa\@tempc
2202 \let\HTMLar\@tempb
2203 \else
2204 \def\@tempc{labels}%
2205 \ifx\@tempa\@tempc
2206 \let\HTMLendarray\HTMLendarraylabels
2207 \else
2208 \def\@tempc{colspec}%
2209 \ifx\@tempa\@tempc
2210 \HTMLamakepream{#2}%
2211 \fi
2212 \fi
2213 \fi
2214 \fi
2215 \fi}
2216 % \end{macrocode}
2217 % \end{macro}
2218 %
2219 % \begin{macro}{\arrayimplied}
2220 \def\arrayimplied#1{%
2221 \def\@tempa{labels}\def\@tempb{#1}%
2222 \ifx\@tempa\@tempb
2223 \let\HTMLendarray\HTMLendarraylabels
2224 \fi}
2225 % \end{macro}
2226 %
2227 % \begin{macro}{\itemdo}
2228 % Handle ITEM attributes
2229 % \begin{macrocode}
2230 \def\itemdo#1#2{%
2231 \def\@tempa{#1}\def\@tempb{#2}%
2232 \def\@tempc{colspan}%
2233 \ifx\@tempa\@tempc
2234 \global\HTMLcolspan#2\relax
2235 \gdef\@gtempa{\@multispan#2\relax\global\advance\HTMLcol#2\relax}%
2236 \else
2237 \def\@tempc{align}%
2238 \ifx\@tempa\@tempc
2239 \def\@tempc{left}%
2240 \ifx\@tempb\@tempc
2241 \gdef\@gtempb{\let\HTMLaleft\relax}%
2242 \else
2243 \def\@tempc{right}%
2244 \ifx\@tempb\@tempc
2245 \gdef\@gtempb{\let\HTMLaright\relax}%
2246 \fi
2247 \fi
2248 \else
2249 \def\@tempc{rowspan}%
2250 \ifx\@tempa\@tempc
2251 \global\HTMLrowspan#2\relax
2252 \gdef\@gtempc{%
2253 \@tempcnta=\HTMLrow
2254 \advance\@tempcnta\HTMLrowspan
2255 % \end{macrocode}
2256 %
2257 % Double loop adds all the entries below this a ROWSPAN entry
2258 % to |\spanitems| list.
2259 % \begin{macrocode}
2260 \loop
2261 \@tempcntb=\HTMLcol
2262 \advance\@tempcntb\HTMLcolspan
2263 \advance\@tempcnta\m@ne
2264 \ifnum\@tempcnta>\HTMLrow
2265 {\loop
2266 \xdef\spanitems{%
2267 \spanitems\the\@tempcnta/\the\@tempcntb,}%
2268 \advance\@tempcntb\m@ne
2269 \ifnum\@tempcntb>\HTMLcol
2270 \repeat}%
2271 \repeat}%
2272 \fi
2273 \fi
2274 \fi}
2275 % \end{macrocode}
2276 % \end{macro}
2277 %
2278 % \begin{macro}{\spanitems}
2279 % Initial value for list of spanned entries.
2280 % \begin{macrocode}
2281 \def\spanitems{,}
2282 % \end{macrocode}
2283 % \end{macro}
2284 %
2285 % \begin{macrocode}
2286 \SGMLentity{thinsp}{\,}
2287 \SGMLentity{emsp}{\quad}
2288 % \end{macrocode}
2289 %
2290 % Far from final list of math symbol entity names\ldots
2291 % \begin{macrocode}
2292 \SGMLentity{alpha}{\alpha}
2293 \SGMLentity{beta}{\beta}
2294 \SGMLentity{gamma}{\gamma}
2295 \SGMLentity{Gamma}{\Gamma}
2296 % \end{macrocode}
2297 %
2298 % \begin{macrocode}
2299 \SGMLentity{int}{\int}
2300 \SGMLentity{sum}{\sum}
2301 % \end{macrocode}
2302 %
2303 % \begin{macrocode}
2304 \SGMLentity{lbrace}{\lbrace}
2305 \SGMLentity{rbrace}{\rbrace}
2306 % \end{macrocode}
2307 %
2308 % \begin{macrocode}
2309 \SGMLentity{times}{\times}
2310 \SGMLentity{cup}{\cup}
2311 \SGMLentity{cap}{\cap}
2312 \SGMLentity{vee}{\vee}
2313 \SGMLentity{wedge}{\wedge}
2314 \SGMLentity{infty}{\infty}
2315 \SGMLentity{oplus}{\oplus}
2316 \SGMLentity{ominus}{\ominus}
2317 \SGMLentity{otimes}{\otimes}
2318 % \end{macrocode}
2319 %
2320 % \begin{macrocode}
2321 \SGMLentity{sin}{\sin}
2322 \SGMLentity{cos}{\cos}
2323 \SGMLentity{tan}{\tan}
2324 % \end{macrocode}
2325 %
2326 % \section{HTML3 Tables}
2327 % \changes{v0.09}{1996/03/21}{TABLE added (mjd)}
2328 % Not done yet, but here is a start\ldots
2329 %
2330 % Final version will probably need primitive |\halign| coding
2331 % as for (but hopefully better than) array stuff above. Also
2332 % will need to be lontable-like.
2333 %
2334 % This is all very slapdash and temporary [mjd,1996/03/20].
2335 % Don't expect good-looking results, just results, occasionally.
2336 %
2337 % \begin{macrocode}
2338 \SGMLdef<table>{\begin{table}[htp]\centering\begin{tabular}{*{10}c}}
2339 \SGMLdef</table>{\end{tabular}\end{table}}
2340 \SGMLdef<tr>{\ifhmode\expandafter\\\fi\relax}
2341 \SGMLdef</tr>{\\\relax}
2342 \SGMLdef<td>{\ifvmode\else\expandafter\hiddenamp\fi}
2343 \def\hiddenamp{&}
2344 % \end{macrocode}
2345 % if |<td>| is present for each cell, then |</td>| doesn't
2346 % need to do anything
2347 % \begin{macrocode}
2348 \SGMLdef</td>{}
2349 % \end{macrocode}
2350 %
2351 % Whoa, if I'm to define caption properly I'd have to look up
2352 % how/where it's used. Who, lazy old me?
2353 %
2354 % \begin{macrocode}
2355 \SGMLdef<caption>{\end{tabular}\begingroup\bfseries}
2356 \SGMLdef</caption>{\endgroup\par\smallskip\begin{tabular}{*{10}{c}}}
2357 % \end{macrocode}
2358 %
2359 % \begin{macrocode}
2360 %</package>
2361 % \end{macrocode}
2362 %
2363 % \Finale
2364 %

  ViewVC Help
Powered by ViewVC 1.1.5