1%
2% $Id$
3% LaTeX2HTML Version 96.2 : html.sty
4%
5% This file contains definitions of LaTeX commands which are
6% processed in a special way by the translator.
7% For example, there are commands for embedding external hypertext links,
8% for cross-references between documents or for including raw HTML.
9% This file includes the comments.sty file v2.0 by Victor Eijkhout
10% In most cases these commands do nothing when processed by LaTeX.
11%
12% Place this file in a directory accessible to LaTeX (i.e., somewhere
13% in the TEXINPUTS path.)
14%
15% NOTE: This file works with LaTeX 2.09 or (the newer) LaTeX2e.
16%       If you only have LaTeX 2.09, some complex LaTeX2HTML features
17%       like support for segmented documents are not available.
18
19% Changes:
20% See the change log at end of file.
21
22
23% Exit if the style file is already loaded
24% (suggested by Lee Shombert <las@potomac.wash.inmet.com>
25\ifx \htmlstyloaded\relax \endinput\else\let\htmlstyloaded\relax\fi
26\makeatletter
27
28\newcommand{\latextohtml}{\LaTeX2\texttt{HTML}}
29
30
31%%% LINKS TO EXTERNAL DOCUMENTS
32%
33% This can be used to provide links to arbitrary documents.
34% The first argumment should be the text that is going to be
35% highlighted and the second argument a URL.
36% The hyperlink will appear as a hyperlink in the HTML
37% document and as a footnote in the dvi or ps files.
38%
39\newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}}
40
41
42% This is an alternative definition of the command above which
43% will ignore the URL in the dvi or ps files.
44\newcommand{\htmladdnormallink}[2]{#1}
45
46
47% This command takes as argument a URL pointing to an image.
48% The image will be embedded in the HTML document but will
49% be ignored in the dvi and ps files.
50%
51\newcommand{\htmladdimg}[1]{}
52
53
54%%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS
55%
56% This can be used to refer to symbolic labels in other Latex
57% documents that have already been processed by the translator.
58% The arguments should be:
59% #1 : the URL to the directory containing the external document
60% #2 : the path to the labels.pl file of the external document.
61% If the external document lives on a remote machine then labels.pl
62% must be copied on the local machine.
63%
64%e.g. \externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html}
65%                    {/usr/cblelca/nikos/tmp/labels.pl}
66% The arguments are ignored in the dvi and ps files.
67%
68\newcommand{\externallabels}[2]{}
69
70
71% This complements the \externallabels command above. The argument
72% should be a label defined in another latex document and will be
73% ignored in the dvi and ps files.
74%
75\newcommand{\externalref}[1]{}
76
77
78% Suggested by  Uffe Engberg (http://www.brics.dk/~engberg/)
79% This allows the same effect for citations in external bibliographies.
80% An  \externallabels  command must be given, locating a labels.pl file
81% which defines the location and keys used in the external .html file.
82%
83\newcommand{\externalcite}{\nocite}
84
85
86%%% HTMLRULE
87% This command adds a horizontal rule and is valid even within
88% a figure caption.
89% Here we introduce a stub for compatibility.
90\newcommand{\htmlrule}{\protect\HTMLrule}
91\newcommand{\HTMLrule}{\@ifstar\@htmlrule\@htmlrule}
92\newcommand{\@htmlrule}[1]{}
93
94% This command adds information within the <BODY> ... </BODY> tag
95%
96\newcommand{\bodytext}[1]{}
97\newcommand{\htmlbody}{}
98
99
100%%% HYPERREF
101% Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm>
102% Similar to \ref but accepts conditional text.
103% The first argument is HTML text which will become ``hyperized''
104% (underlined).
105% The second and third arguments are text which will appear only in the paper
106% version (DVI file), enclosing the fourth argument which is a reference to a label.
107%
108%e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace}
109% where there is a corresponding \label{trace}
110%
111\newcommand{\hyperref}{\hyperrefx[ref]}
112\def\hyperrefx[#1]{{\def\next{#1}%
113 \def\tmp{ref}\ifx\next\tmp\aftergroup\hyperrefref
114 \else\def\tmp{pageref}\ifx\next\tmp\aftergroup\hyperpageref
115 \else\def\tmp{page}\ifx\next\tmp\aftergroup\hyperpageref
116 \else\def\tmp{noref}\ifx\next\tmp\aftergroup\hypernoref
117 \else\def\tmp{no}\ifx\next\tmp\aftergroup\hypernoref
118 \else\typeout{*** unknown option \next\space to  hyperref ***}%
119 \fi\fi\fi\fi\fi}}
120\newcommand{\hyperrefref}[4]{#2\ref{#4}#3}
121\newcommand{\hyperpageref}[4]{#2\pageref{#4}#3}
122\newcommand{\hypernoref}[3]{#2}
123
124
125%%% HYPERCITE --- added by RRM
126% Suggested by Stephen Simpson <simpson@math.psu.edu>
127% effects the same ideas as in  \hyperref, but for citations.
128% It does not allow an optional argument to the \cite, in LaTeX.
129%
130%   \hypercite{<html-text>}{<LaTeX-text>}{<opt-text>}{<key>}
131%
132% uses the pre/post-texts in LaTeX, with a  \cite{<key>}
133%
134%   \hypercite[ext]{<html-text>}{<LaTeX-text>}{<key>}
135%
136% uses the pre/post-texts in LaTeX, with a  \nocite{<key>}
137% the actual reference comes from an \externallabels  file.
138%
139\newcommand{\hypercite}{\hypercitex[int]}
140\def\hypercitex[#1]{{\def\next{#1}%
141 \def\tmp{int}\ifx\next\tmp\aftergroup\hyperciteint
142 \else\def\tmp{cite}\ifx\next\tmp\aftergroup\hyperciteint
143 \else\def\tmp{ext}\ifx\next\tmp\aftergroup\hyperciteext
144 \else\def\tmp{nocite}\ifx\next\tmp\aftergroup\hyperciteext
145 \else\def\tmp{no}\ifx\next\tmp\aftergroup\hyperciteext
146 \else\typeout{*** unknown option \next\space to  hypercite ***}%
147 \fi\fi\fi\fi\fi}}
148\newcommand{\hyperciteint}[4]{#2{\def\tmp{#3}\def\emptyopt{}%
149 \ifx\tmp\emptyopt\cite{#4}\else\cite[#3]{#4}\fi}}
150\newcommand{\hyperciteext}[3]{#2\nocite{#3}}
151
152
153
154%%% HTMLREF
155% Reference in HTML version only.
156% Mix between \htmladdnormallink and \hyperref.
157% First arg is text for in both versions, second is label for use in HTML
158% version.
159\newcommand{\htmlref}[2]{#1}
160
161%%% HTMLCITE
162% Reference in HTML version only.
163% Mix between \htmladdnormallink and \hypercite.
164% First arg is text for in both versions, second is citation for use in HTML
165% version.
166\newcommand{\htmlcite}[2]{#1}
167
168
169%%% HTMLIMAGE
170% This command can be used inside any environment that is converted
171% into an inlined image (eg a "figure" environment) in order to change
172% the way the image will be translated. The argument of \htmlimage
173% is really a string of options separated by commas ie
174% [scale=<scale factor>],[external],[thumbnail=<reduction factor>
175% The scale option allows control over the size of the final image.
176% The ``external'' option will cause the image not to be inlined
177% (images are inlined by default). External images will be accessible
178% via a hypertext link.
179% The ``thumbnail'' option will cause a small inlined image to be
180% placed in the caption. The size of the thumbnail depends on the
181% reduction factor. The use of the ``thumbnail'' option implies
182% the ``external'' option.
183%
184% Example:
185% \htmlimage{scale=1.5,external,thumbnail=0.2}
186% will cause a small thumbnail image 1/5th of the original size to be
187% placed in the final document, pointing to an external image 1.5
188% times bigger than the original.
189%
190\newcommand{\htmlimage}[1]{}
191
192
193% \htmlborder causes a border to be placed around an image or table
194% when the image is placed within a <TABLE> cell.
195\newcommand{\htmlborder}[1]{}
196
197% Put \begin{makeimage}, \end{makeimage} around LaTeX to ensure its
198% translation into an image.
199% This shields sensitive text from being translated.
200\newenvironment{makeimage}{}{}
201
202
203%%% HTMLADDTONAVIGATION
204% This command appends its argument to the buttons in the navigation
205% panel. It is ignored by LaTeX.
206%
207% Example:
208% \htmladdtonavigation{\htmladdnormallink
209%              {\htmladdimg{http://server/path/to/gif}}
210%              {http://server/path}}
211\newcommand{\htmladdtonavigation}[1]{}
212
213
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215% Comment.sty   version 2.0, 19 June 1992
216% selectively in/exclude pieces of text: the user can define new
217% comment versions, and each is controlled separately.
218% This style can be used with plain TeX or LaTeX, and probably
219% most other packages too.
220%
221% Examples of use in LaTeX and TeX follow \endinput
222%
223% Author
224%    Victor Eijkhout
225%    Department of Computer Science
226%    University Tennessee at Knoxville
227%    104 Ayres Hall
228%    Knoxville, TN 37996
229%    USA
230%
231%    eijkhout@cs.utk.edu
232%
233% Usage: all text included in between
234%    \comment ... \endcomment
235% or \begin{comment} ... \end{comment}
236% is discarded. The closing command should appear on a line
237% of its own. No starting spaces, nothing after it.
238% This environment should work with arbitrary amounts
239% of comment.
240%
241% Other 'comment' environments are defined by
242% and are selected/deselected with
243% \includecomment{versiona}
244% \excludecoment{versionb}
245%
246% These environments are used as
247% \versiona ... \endversiona
248% or \begin{versiona} ... \end{versiona}
249% with the closing command again on a line of its own.
250%
251% Basic approach:
252% to comment something out, scoop up  every line in verbatim mode
253% as macro argument, then throw it away.
254% For inclusions, both the opening and closing comands
255% are defined as noop
256%
257% Changed \next to \html@next to prevent clashes with other sty files
258% (mike@emn.fr)
259% Changed \html@next to \htmlnext so the \makeatletter and
260% \makeatother commands could be removed (they were causing other
261% style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
262% Changed \htmlnext back to \html@next...
263
264\def\makeinnocent#1{\catcode`#1=12 }
265\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
266
267\def\ThrowAwayComment#1{\begingroup
268    \def\CurrentComment{#1}%
269    \let\do\makeinnocent \dospecials
270    \makeinnocent\^^L% and whatever other special cases
271    \endlinechar`\^^M \catcode`\^^M=12 \xComment}
272{\catcode`\^^M=12 \endlinechar=-1 %
273 \gdef\xComment#1^^M{\def\test{#1}\edef\test{\meaning\test}
274      \csarg\ifx{PlainEnd\CurrentComment Test}\test
275          \let\html@next\endgroup
276      \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
277            \edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
278      \else \csarg\ifx{LaInnEnd\CurrentComment Test}\test
279            \edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
280      \else \let\html@next\xComment
281      \fi \fi \fi \html@next}
282}
283
284\def\includecomment
285 #1{\expandafter\def\csname#1\endcsname{}%
286    \expandafter\def\csname end#1\endcsname{}}
287\def\excludecomment
288 #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
289    {\escapechar=-1\relax
290     \edef\tmp{\string\\end#1}%
291      \csarg\xdef{PlainEnd#1Test}{\meaning\tmp}%
292     \edef\tmp{\string\\end\string\{#1\string\}}%
293      \csarg\xdef{LaLaEnd#1Test}{\meaning\tmp}%
294     \edef\tmp{\string\\end \string\{#1\string\}}%
295      \csarg\xdef{LaInnEnd#1Test}{\meaning\tmp}%
296    }}
297
298\excludecomment{comment}
299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300% end Comment.sty
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302
303
304%%% RAW HTML
305%
306% Enclose raw HTML between a \begin{rawhtml} and \end{rawhtml}.
307% The html environment ignores its body
308%
309\excludecomment{rawhtml}
310
311
312%%% HTML ONLY
313%
314% Enclose LaTeX constructs which will only appear in the
315% HTML output and will be ignored by LaTeX with
316% \begin{htmlonly} and \end{htmlonly}
317%
318\excludecomment{htmlonly}
319% Shorter version
320\newcommand{\html}[1]{}
321
322% for images.tex only
323\excludecomment{imagesonly}
324
325%%% LaTeX ONLY
326% Enclose LaTeX constructs which will only appear in the
327% DVI output and will be ignored by latex2html with
328%\begin{latexonly} and \end{latexonly}
329%
330\newenvironment{latexonly}{}{}
331% Shorter version
332\newcommand{\latex}[1]{#1}
333
334
335%%% LaTeX or HTML
336% Combination of \latex and \html.
337% Say \latexhtml{this should be latex text}{this html text}
338%
339%\newcommand{\latexhtml}[2]{#1}
340\long\def\latexhtml#1#2{#1}
341
342
343%%% tracing the HTML conversions
344% This alters the tracing-level within the processing
345% performed by  latex2html  by adjusting  $VERBOSITY
346% (see  latex2html.config  for the appropriate values)
347%
348\newcommand{\htmltracing}[1]{}
349\newcommand{\htmltracenv}[1]{}
350
351
352%%%  \strikeout for HTML only
353% uses <STRIKE>...</STRIKE> tags on the argument
354% LaTeX just gobbles it up.
355\newcommand{\strikeout}[1]{}
356
357
358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359%%% JCL - stop input here if LaTeX2e is not present
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361\ifx\if@compatibility\undefined
362  %LaTeX209
363  \makeatother\relax\expandafter\endinput
364\fi
365\if@compatibility
366  %LaTeX2e in LaTeX209 compatibility mode
367  \makeatother\relax\expandafter\endinput
368\fi
369
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371%
372% Start providing LaTeX2e extension:
373% This is currently:
374%  - additional optional argument for \htmladdimg
375%  - support for segmented documents
376%
377
378\ProvidesPackage{html}
379          [1996/12/22 v1.1 hypertext commands for latex2html (nd, hws, rrm)]
380%%%%MG
381
382% This command takes as argument a URL pointing to an image.
383% The image will be embedded in the HTML document but will
384% be ignored in the dvi and ps files.  The optional argument
385% denotes additional HTML tags.
386%
387% Example:  \htmladdimg[ALT="portrait" ALIGN=CENTER]{portrait.gif}
388%
389\renewcommand{\htmladdimg}[2][]{}
390
391%%% HTMLRULE for LaTeX2e
392% This command adds a horizontal rule and is valid even within
393% a figure caption.
394%
395% This command is best used with LaTeX2e and HTML 3.2 support.
396% It is like \hrule, but allows for options via key--value pairs
397% as follows:  \htmlrule[key1=value1, key2=value2, ...] .
398% Use \htmlrule* to suppress the <BR> tag.
399% Eg. \htmlrule[left, 15, 5pt, "none", NOSHADE] produces
400% <BR CLEAR="left"><HR NOSHADE SIZE="15">.
401% Renew the necessary part.
402\renewcommand{\@htmlrule}[1][all]{}
403
404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
405%
406%  renew some definitions to allow optional arguments
407%
408% The description of the options is missing, as yet.
409%
410\renewcommand{\latextohtml}{\textup{\LaTeX2\texttt{HTML}}}
411\renewcommand{\htmladdnormallinkfoot}[3][]{#2\footnote{#3}}
412\renewcommand{\htmladdnormallink}[3][]{#2}
413\renewcommand{\htmlbody}[1][]{}
414\renewcommand{\hyperref}[1][ref]{\hyperrefx[#1]}
415\renewcommand{\hypercite}[1][int]{\hypercitex[#1]}
416\renewcommand{\htmlref}[3][]{#2}
417\renewcommand{\htmlcite}[1]{#1\htmlcitex}
418\newcommand{\htmlcitex}[2][]{{\def\tmp{#1}\ifx\tmp\@empty\else~[#1]\fi}}
419\renewcommand{\htmlimage}[2][]{}
420\renewcommand{\htmlborder}[2][]{}
421
422
423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424%
425%  HTML  HTMLset  HTMLsetenv
426%
427%  These commands do nothing in LaTeX, but can be used to place
428%  HTML tags or set Perl variables during the LaTeX2HTML processing;
429%  They are intended for expert use only.
430
431\newcommand{\HTML}[2][]{}
432\newcommand{\HTMLset}[3][]{}
433\newcommand{\HTMLsetenv}[3][]{}
434
435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436%
437% The following commands pertain to document segmentation, and
438% were added by Herbert Swan <dprhws@edp.Arco.com> (with help from
439% Michel Goossens <goossens@cern.ch>):
440%
441%
442% This command inputs internal latex2html tables so that large
443% documents can to partitioned into smaller (more manageable)
444% segments.
445%
446\newcommand{\internal}[2][internals]{}
447
448%
449%  Define a dummy stub \htmlhead{}.  This command causes latex2html
450%  to define the title of the start of a new segment.  It is not
451%  normally placed in the user's document.  Rather, it is passed to
452%  latex2html via a .ptr file written by \segment.
453%
454\newcommand{\htmlhead}[3][]{}
455
456%  In the LaTeX2HTML version this will eliminate the title line
457%  generated by a \segment command, but retains the title string
458%  for use in other places.
459%
460\newcommand{\htmlnohead}{}
461
462
463%  In the LaTeX2HTML version this put a URL into a <BASE> tag
464%  within the <HEAD>...</HEAD> portion of a document.
465%
466\newcommand{\htmlbase}[1]{}
467%
468
469%
470%  The dummy command \endpreamble is needed by latex2html to
471%  mark the end of the preamble in document segments that do
472%  not contain a \begin{document}
473%
474\newcommand{\startdocument}{}
475
476%
477%  These do nothing in LaTeX but for LaTeX2HTML
478%  they mark where the table of child-links and info-page
479%  should be placed, when the user wants other than the default.
480%  The *-versions omit the preceding <BR> tag.
481%
482\newcommand{\tableofchildlinks}{\@ifstar\@tochildlinks\@tochildlinks}
483\newcommand{\@tochildlinks}{}
484
485\newcommand{\htmlinfo}{\@ifstar\@htmlinfo\@htmlinfo}
486\newcommand{\@htmlinfo}{}
487
488%
489%  Allocate a new set of section counters, which will get incremented
490%  for "*" forms of sectioning commands, and for a few miscellaneous
491%  commands.
492%
493
494\newcounter{lpart}
495\newcounter{lchapter}[part]
496\@ifundefined{chapter}{\newcounter{lsection}[part]}{\newcounter{lsection}[chapter]}
497\newcounter{lsubsection}[section]
498\newcounter{lsubsubsection}[subsection]
499\newcounter{lparagraph}[subsubsection]
500\newcounter{lsubparagraph}[paragraph]
501\newcounter{lequation}
502
503%
504%  Redefine "*" forms of sectioning commands to increment their
505%  respective counters.
506%
507\let\Hpart=\part
508\let\Hchapter=\chapter
509\let\Hsection=\section
510\let\Hsubsection=\subsection
511\let\Hsubsubsection=\subsubsection
512\let\Hparagraph=\paragraph
513\let\Hsubparagraph=\subparagraph
514\let\Hsubsubparagraph=\subsubparagraph
515
516\ifx\c@subparagraph\undefined
517 \newcounter{lsubsubparagraph}[lsubparagraph]
518\else
519 \newcounter{lsubsubparagraph}[subparagraph]
520\fi
521
522%
523%  The following definitions are specific to LaTeX2e:
524%  (They must be commented out for LaTeX 2.09)
525%
526\renewcommand{\part}{\@ifstar{\stepcounter{lpart}%
527  \bgroup\def\tmp{*}\H@part}{\bgroup\def\tmp{}\H@part}}
528\newcommand{\H@part}[1][]{%
529 \expandafter\egroup\expandafter\Hpart\tmp}
530
531\ifx\Hchapter\relax\else\@ifundefined{chapter}{}{%
532 \def\chapter{\resetsections \@ifstar{\stepcounter{lchapter}%
533   \bgroup\def\tmp{*}\H@chapter}{\bgroup\def\tmp{}\H@chapter}}}\fi
534\newcommand{\H@chapter}[1][]{%
535 \expandafter\egroup\expandafter\Hchapter\tmp}
536
537\renewcommand{\section}{\resetsubsections
538 \@ifstar{\stepcounter{lsection}\bgroup\def\tmp{*}%
539   \H@section}{\bgroup\def\tmp{}\H@section}}
540\newcommand{\H@section}[1][]{%
541 \expandafter\egroup\expandafter\Hsection\tmp}
542
543\renewcommand{\subsection}{\resetsubsubsections
544 \@ifstar{\stepcounter{lsubsection}\bgroup\def\tmp{*}%
545   \H@subsection}{\bgroup\def\tmp{}\H@subsection}}
546\newcommand{\H@subsection}[1][]{%
547 \expandafter\egroup\expandafter\Hsubsection\tmp}
548
549\renewcommand{\subsubsection}{\resetparagraphs
550 \@ifstar{\stepcounter{lsubsubsection}\bgroup\def\tmp{*}%
551   \H@subsubsection}{\bgroup\def\tmp{}\H@subsubsection}}
552\newcommand{\H@subsubsection}[1][]{%
553 \expandafter\egroup\expandafter\Hsubsubsection\tmp}
554
555\renewcommand{\paragraph}{\resetsubparagraphs
556 \@ifstar{\stepcounter{lparagraph}\bgroup\def\tmp{*}%
557   \H@paragraph}{\bgroup\def\tmp{}\H@paragraph}}
558\newcommand\H@paragraph[1][]{%
559 \expandafter\egroup\expandafter\Hparagraph\tmp}
560
561\renewcommand{\subparagraph}{\resetsubsubparagraphs
562 \@ifstar{\stepcounter{lsubparagraph}\bgroup\def\tmp{*}%
563   \H@subparagraph}{\bgroup\def\tmp{}\H@subparagraph}}
564\newcommand\H@subparagraph[1][]{%
565 \expandafter\egroup\expandafter\Hsubparagraph\tmp}
566
567\ifx\Hsubsubparagraph\relax\else\@ifundefined{subsubparagraph}{}{%
568\def\subsubparagraph{%
569 \@ifstar{\stepcounter{lsubsubparagraph}\bgroup\def\tmp{*}%
570   \H@subsubparagraph}{\bgroup\def\tmp{}\H@subsubparagraph}}}\fi
571\newcommand\H@subsubparagraph[1][]{%
572 \expandafter\egroup\expandafter\Hsubsubparagraph\tmp}
573%
574\def\resetsections{\setcounter{section}{0}\setcounter{lsection}{0}%
575 \reset@dependents{section}\resetsubsections }
576\def\resetsubsections{\setcounter{subsection}{0}\setcounter{lsubsection}{0}%
577 \reset@dependents{subsection}\resetsubsubsections }
578\def\resetsubsubsections{\setcounter{subsubsection}{0}\setcounter{lsubsubsection}{0}%
579 \reset@dependents{subsubsection}\resetparagraphs }
580%
581\def\resetparagraphs{\setcounter{lparagraph}{0}\setcounter{lparagraph}{0}%
582 \reset@dependents{paragraph}\resetsubparagraphs }
583\def\resetsubparagraphs{\ifx\c@subparagraph\undefined\else
584  \setcounter{subparagraph}{0}\fi \setcounter{lsubparagraph}{0}%
585 \reset@dependents{subparagraph}\resetsubsubparagraphs }
586\def\resetsubsubparagraphs{\ifx\c@subsubparagraph\undefined\else
587  \setcounter{subsubparagraph}{0}\fi \setcounter{lsubsubparagraph}{0}}
588%
589\def\reset@dependents#1{\begingroup\let \@elt \@stpelt
590 \csname cl@#1\endcsname\endgroup}
591%
592%
593%  Define a helper macro to dump a single \secounter command to a file.
594%
595\newcommand{\DumpPtr}[2]{%
596\count255=\arabic{#1}\def\dummy{dummy}\def\tmp{#2}%
597\ifx\tmp\dummy\else\advance\count255 by \arabic{#2}\fi
598\immediate\write\ptrfile{%
599\noexpand\setcounter{#1}{\number\count255}}}
600
601%
602%  Define a helper macro to dump all counters to the file.
603%  The value for each counter will be the sum of the l-counter
604%      actual LaTeX section counter.
605%  Also dump an \htmlhead{section-command}{section title} command
606%      to the file.
607%
608\newwrite\ptrfile
609\def\DumpCounters#1#2#3#4{%
610\begingroup\let\protect=\noexpand
611\immediate\openout\ptrfile = #1.ptr
612\DumpPtr{part}{lpart}%
613\ifx\Hchapter\relax\else\DumpPtr{chapter}{lchapter}\fi
614\DumpPtr{section}{lsection}%
615\DumpPtr{subsection}{lsubsection}%
616\DumpPtr{subsubsection}{lsubsubsection}%
617\DumpPtr{paragraph}{lparagraph}%
618\DumpPtr{subparagraph}{lsubparagraph}%
619\DumpPtr{equation}{lequation}%
620\DumpPtr{footnote}{dummy}%
621\def\tmp{#4}\ifx\tmp\@empty
622\immediate\write\ptrfile{\noexpand\htmlhead{#2}{#3}}\else
623\immediate\write\ptrfile{\noexpand\htmlhead[#4]{#2}{#3}}\fi
624\dumpcitestatus \dumpcurrentcolor
625\immediate\closeout\ptrfile
626\endgroup }
627
628
629%% interface to natbib.sty
630
631\def\dumpcitestatus{}
632\def\loadcitestatus{\def\dumpcitestatus{%
633  \ifciteindex\immediate\write\ptrfile{\noexpand\citeindextrue}%
634  \else\immediate\write\ptrfile{\noexpand\citeindexfalse}\fi }%
635}
636\@ifpackageloaded{natbib}{\loadcitestatus}{%
637 \AtBeginDocument{\@ifpackageloaded{natbib}{\loadcitestatus}{}}}
638
639
640%% interface to color.sty
641
642\def\dumpcurrentcolor{}
643\def\loadsegmentcolors{%
644 \let\real@pagecolor=\pagecolor
645 \let\pagecolor\segmentpagecolor
646 \let\segmentcolor\color
647 \ifx\current@page@color\undefined \def\current@page@color{{}}\fi
648 \def\dumpcurrentcolor{\bgroup\def\@empty@{{}}%
649   \expandafter\def\expandafter\tmp\space####1@{\def\thiscol{####1}}%
650  \ifx\current@color\@empty@\def\thiscol{}\else
651   \expandafter\tmp\current@color @\fi
652  \immediate\write\ptrfile{\noexpand\segmentcolor{\thiscol}}%
653  \ifx\current@page@color\@empty@\def\thiscol{}\else
654   \expandafter\tmp\current@page@color @\fi
655  \immediate\write\ptrfile{\noexpand\segmentpagecolor{\thiscol}}%
656 \egroup}%
657 \global\let\loadsegmentcolors=\relax
658}
659
660% These macros are needed within  images.tex  since this inputs
661% the <segment>.ptr files for a segment, so that counters are
662% colors are synchronised.
663%
664\newcommand{\segmentpagecolor}[1][]{%
665 \@ifpackageloaded{color}{\loadsegmentcolors\bgroup
666  \def\tmp{#1}\ifx\@empty\tmp\def\next{[]}\else\def\next{[#1]}\fi
667  \expandafter\segmentpagecolor@\next}%
668 {\@gobble}}
669\def\segmentpagecolor@[#1]#2{\def\tmp{#1}\def\tmpB{#2}%
670 \ifx\tmpB\@empty\let\next=\egroup
671 \else
672  \let\realendgroup=\endgroup
673  \def\endgroup{\edef\next{\noexpand\realendgroup
674   \def\noexpand\current@page@color{\current@color}}\next}%
675  \ifx\tmp\@empty\real@pagecolor{#2}\def\model{}%
676  \else\real@pagecolor[#1]{#2}\def\model{[#1]}%
677  \fi
678  \edef\next{\egroup\def\noexpand\current@page@color{\current@page@color}%
679  \noexpand\real@pagecolor\model{#2}}%
680 \fi\next}
681%
682\newcommand{\segmentcolor}[2][named]{\@ifpackageloaded{color}%
683 {\loadsegmentcolors\segmentcolor[#1]{#2}}{}}
684
685\@ifpackageloaded{color}{\loadsegmentcolors}{\let\real@pagecolor=\@gobble
686 \AtBeginDocument{\@ifpackageloaded{color}{\loadsegmentcolors}{}}}
687
688
689%  Define the \segment[align]{file}{section-command}{section-title} command,
690%  and its helper macros.  This command does four things:
691%       1)  Begins a new LaTeX section;
692%       2)  Writes a list of section counters to file.ptr, each
693%           of which represents the sum of the LaTeX section
694%           counters, and the l-counters, defined above;
695%       3)  Write an \htmlhead{section-title} command to file.ptr;
696%       4)  Inputs file.tex.
697
698
699\def\segment{\@ifstar{\@@htmls}{\@@html}}
700\newcommand{\@@htmls}[1][]{\@@htmlsx{#1}}
701\newcommand{\@@html}[1][]{\@@htmlx{#1}}
702\def\@@htmlsx#1#2#3#4{\csname #3\endcsname* {#4}%
703                   \DumpCounters{#2}{#3*}{#4}{#1}\input{#2}}
704\def\@@htmlx#1#2#3#4{\csname #3\endcsname {#4}%
705                   \DumpCounters{#2}{#3}{#4}{#1}\input{#2}}
706
707\makeatother
708\endinput
709
710
711% Modifications:
712%
713% (The listing of Initiales see Changes)
714
715% $Log: not supported by cvs2svn $
716% Revision 1.1  2000/02/04 02:38:02  edo
717% changed preamble to Late2e standard
718% added pdflatex output (type make pdf)
719% created zmatx.pdf with Adobe distiller
720%
721% Revision 1.2  1997/07/10 06:16:42  RRM
722%      LaTeX styles, used in the v97.1 manual
723%
724% Revision 1.17  1997/07/08 11:23:39  RRM
725%     include value of footnote counter in .ptr files for segments
726%
727% Revision 1.16  1997/07/03 08:56:34  RRM
728%     use \textup  within the \latextohtml macro
729%
730% Revision 1.15  1997/06/15 10:24:58  RRM
731%      new command  \htmltracenv  as environment-ordered \htmltracing
732%
733% Revision 1.14  1997/06/06 10:30:37  RRM
734%  -   new command:  \htmlborder  puts environment into a <TABLE> cell
735%      with a border of specified width, + other attributes.
736%  -   new commands: \HTML  for setting arbitrary HTML tags, with attributes
737%                    \HTMLset  for setting Perl variables, while processing
738%                    \HTMLsetenv  same as \HTMLset , but it gets processed
739%                                 as if it were an environment.
740%  -   new command:  \latextohtml  --- to set the LaTeX2HTML name/logo
741%  -   fixed some remaining problems with \segmentcolor & \segmentpagecolor
742%
743% Revision 1.13  1997/05/19 13:55:46  RRM
744%      alterations and extra options to  \hypercite
745%
746% Revision 1.12  1997/05/09 12:28:39  RRM
747%  -  Added the optional argument to \htmlhead, also in \DumpCounters
748%  -  Implemented \HTMLset as a no-op in LaTeX.
749%  -  Fixed a bug in accessing the page@color settings.
750%
751% Revision 1.11  1997/03/26 09:32:40  RRM
752%  -  Implements LaTeX versions of  \externalcite  and  \hypercite  commands.
753%     Thanks to  Uffe Engberg  and  Stephen Simpson  for the suggestions.
754%
755% Revision 1.10  1997/03/06 07:37:58  RRM
756% Added the  \htmltracing  command, for altering  $VERBOSITY .
757%
758% Revision 1.9  1997/02/17 02:26:26  RRM
759% - changes to counter handling (RRM)
760% - shuffled around some definitions
761% - changed \htmlrule of 209 mode
762%
763% Revision 1.8  1997/01/26 09:04:12  RRM
764% RRM: added optional argument to sectioning commands
765%      \htmlbase  sets the <BASE HREF=...> tag
766%      \htmlinfo  and  \htmlinfo* allow the document info to be positioned
767%
768% Revision 1.7  1997/01/03 12:15:44  L2HADMIN
769% % - fixes to the  color  and  natbib  interfaces
770% % - extended usage of  \hyperref, via an optional argument.
771% % - extended use comment environments to allow shifting expansions
772% %     e.g. within \multicolumn  (`bug' reported by Luc De Coninck).
773% % - allow optional argument to: \htmlimage, \htmlhead,
774% %     \htmladdimg, \htmladdnormallink, \htmladdnormallinkfoot
775% % - added new commands: \htmlbody, \htmlnohead
776% % - added new command: \tableofchildlinks
777%
778% Revision 1.6  1996/12/25 03:04:54  JCL
779% added patches to segment feature from Martin Wilck
780%
781% Revision 1.5  1996/12/23 01:48:06  JCL
782%  o introduced the environment makeimage, which may be used to force
783%    LaTeX2HTML to generate an image from the contents.
784%    There's no magic, all what we have now is a defined empty environment
785%    which LaTeX2HTML will not recognize and thus pass it to images.tex.
786%  o provided \protect to the \htmlrule commands to allow for usage
787%    within captions.
788%
789% Revision 1.4  1996/12/21 19:59:22  JCL
790% - shuffled some entries
791% - added \latexhtml command
792%
793% Revision 1.3  1996/12/21 12:22:59  JCL
794% removed duplicate \htmlrule, changed \htmlrule back not to create a \hrule
795% to allow occurrence in caption
796%
797% Revision 1.2  1996/12/20 04:03:41  JCL
798% changed occurrence of \makeatletter, \makeatother
799% added new \htmlrule command both for the LaTeX2.09 and LaTeX2e
800% sections
801%
802%
803% jcl 30-SEP-96
804%  - Stuck the commands commonly used by both LaTeX versions to the top,
805%    added a check which stops input or reads further if the document
806%    makes use of LaTeX2e.
807%  - Introduced rrm's \dumpcurrentcolor and \bodytext
808% hws 31-JAN-96 - Added support for document segmentation
809% hws 10-OCT-95 - Added \htmlrule command
810% jz 22-APR-94 - Added support for htmlref
811% nd  - Created
812