1 % LaTeX2HTML Version 96.1 : html.sty
3 % This file contains definitions of LaTeX commands which are
4 % processed in a special way by the translator.
5 % For example, there are commands for embedding external hypertext links,
6 % for cross-references between documents or for including raw HTML.
7 % This file includes the comments.sty file v2.0 by Victor Eijkhout
8 % In most cases these commands do nothing when processed by LaTeX.
10 % Place this file in a directory accessible to LaTeX (i.e., somewhere
11 % in the TEXINPUTS path.)
13 % NOTE: This file works with LaTeX 2.09 or (the newer) LaTeX2e.
14 % If you only have LaTeX 2.09, some complex LaTeX2HTML features
15 % like support for segmented documents are not available.
20 % (The listing of Initiales see Changes)
23 % - Stuck the commands commonly used by both LaTeX versions to the top,
24 % added a check which stops input or reads further if the document
25 % makes use of LaTeX2e.
26 % - Introduced rrm's \dumpcurrentcolor and \bodytext
27 % hws 31-JAN-96 - Added support for document segmentation
28 % hws 10-OCT-95 - Added \htmlrule command
29 % jz 22-APR-94 - Added support for htmlref
32 % Exit if the style file is already loaded
33 % (suggested by Lee Shombert <las@potomac.wash.inmet.com>
34 \ifx \htmlstyloaded\relax \endinput\else\let\htmlstyloaded\relax\fi
36 %%% LINKS TO EXTERNAL DOCUMENTS
38 % This can be used to provide links to arbitrary documents.
39 % The first argumment should be the text that is going to be
40 % highlighted and the second argument a URL.
41 % The hyperlink will appear as a hyperlink in the HTML
42 % document and as a footnote in the dvi or ps files.
44 \newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}}
46 % This is an alternative definition of the command above which
47 % will ignore the URL in the dvi or ps files.
48 \newcommand{\htmladdnormallink}[2]{#1}
50 % This command takes as argument a URL pointing to an image.
51 % The image will be embedded in the HTML document but will
52 % be ignored in the dvi and ps files.
54 \newcommand{\htmladdimg}[1]{}
56 %%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS
58 % This can be used to refer to symbolic labels in other Latex
59 % documents that have already been processed by the translator.
60 % The arguments should be:
61 % #1 : the URL to the directory containing the external document
62 % #2 : the path to the labels.pl file of the external document.
63 % If the external document lives on a remote machine then labels.pl
64 % must be copied on the local machine.
66 %e.g. \externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html}
67 % {/usr/cblelca/nikos/tmp/labels.pl}
68 % The arguments are ignored in the dvi and ps files.
70 \newcommand{\externallabels}[2]{}
73 % This complements the \externallabels command above. The argument
74 % should be a label defined in another latex document and will be
75 % ignored in the dvi and ps files.
77 \newcommand{\externalref}[1]{}
79 % This command adds a horizontal rule and is valid even within
82 \newcommand{\htmlrule}{}
84 % This command adds information within the <BODY> ... </BODY> tag
86 \newcommand{\bodytext}[1]{}
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 % Comment.sty version 2.0, 19 June 1992
90 % selectively in/exclude pieces of text: the user can define new
91 % comment versions, and each is controlled separately.
92 % This style can be used with plain TeX or LaTeX, and probably
93 % most other packages too.
95 % Examples of use in LaTeX and TeX follow \endinput
99 % Department of Computer Science
100 % University Tennessee at Knoxville
102 % Knoxville, TN 37996
105 % eijkhout@cs.utk.edu
107 % Usage: all text included in between
108 % \comment ... \endcomment
109 % or \begin{comment} ... \end{comment}
110 % is discarded. The closing command should appear on a line
111 % of its own. No starting spaces, nothing after it.
112 % This environment should work with arbitrary amounts
115 % Other 'comment' environments are defined by
116 % and are selected/deselected with
117 % \includecomment{versiona}
118 % \excludecoment{versionb}
120 % These environments are used as
121 % \versiona ... \endversiona
122 % or \begin{versiona} ... \end{versiona}
123 % with the closing command again on a line of its own.
126 % to comment something out, scoop up every line in verbatim mode
127 % as macro argument, then throw it away.
128 % For inclusions, both the opening and closing comands
129 % are defined as noop
131 % Changed \next to \html@next to prevent clashes with other sty files
133 % Changed \html@next to \htmlnext so the \makeatletter and
134 % \makeatother commands could be removed (they were causing other
135 % style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
136 % Changed \htmlnext back to \html@next...
139 \def\makeinnocent#1{\catcode`
#1=
12 }
140 \def\csarg#1#2{\expandafter#1\csname#2\endcsname}
142 \def\ThrowAwayComment#1{\begingroup
143 \def\CurrentComment{#1}%
144 \let\do\makeinnocent \dospecials
145 \makeinnocent\^^L
% and whatever other special cases
146 \endlinechar`\^^M
\catcode`\^^M=
12 \xComment}
147 {\catcode`\^^M=
12 \endlinechar=-
1 %
148 \gdef\xComment#1^^M
{\def\test{#1}
149 \csarg\ifx{PlainEnd
\CurrentComment Test
}\test
150 \let\html@next
\endgroup
151 \else \csarg\ifx{LaLaEnd
\CurrentComment Test
}\test
152 \edef\html@next
{\endgroup\noexpand\end{\CurrentComment}}
153 \else \let\html@next
\xComment
159 #1{\expandafter\def\csname#1\endcsname{}%
160 \expandafter\def\csname end
#1\endcsname{}}
162 #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
163 {\escapechar=-
1\relax
164 \csarg\xdef{PlainEnd
#1Test
}{\string\
\end#1}%
165 \csarg\xdef{LaLaEnd
#1Test
}{\string\
\end\string\
{#1\string\
}}%
168 \excludecomment{comment
}
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173 % Enclose raw HTML between a \begin{rawhtml} and \end{rawhtml}.
174 % The html environment ignores its body
176 \excludecomment{rawhtml
}
180 % Enclose LaTeX constructs which will only appear in the
181 % HTML output and will be ignored by LaTeX with
182 % \begin{htmlonly} and \end{htmlonly}
184 \excludecomment{htmlonly
}
186 \newcommand{\html}[1]{}
190 % Enclose LaTeX constructs which will only appear in the
191 % DVI output and will be ignored by latex2html with
192 %\begin{latexonly} and \end{latexonly}
194 \newenvironment{latexonly
}{}{}
196 \newcommand{\latex}[1]{#1}
199 % Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm>
200 % Similar to \ref but accepts conditional text.
201 % The first argument is HTML text which will become ``hyperized''
203 % The second and third arguments are text which will appear only in the paper
204 % version (DVI file), enclosing the fourth argument which is a reference to a label.
206 %e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace}
207 % where there is a corresponding \label{trace}
209 \newcommand{\hyperref}[4]{#2\ref{#4}#3}
212 % Reference in HTML version only.
213 % Mix between \htmladdnormallink and \hyperref.
214 % First arg is text for in both versions, second is label for use in HTML
216 \newcommand{\htmlref}[2]{#1}
219 % This command can be used inside any environment that is converted
220 % into an inlined image (eg a "figure" environment) in order to change
221 % the way the image will be translated. The argument of \htmlimage
222 % is really a string of options separated by commas ie
223 % [scale=<scale factor>],[external],[thumbnail=<reduction factor>
224 % The scale option allows control over the size of the final image.
225 % The ``external'' option will cause the image not to be inlined
226 % (images are inlined by default). External images will be accessible
227 % via a hypertext link.
228 % The ``thumbnail'' option will cause a small inlined image to be
229 % placed in the caption. The size of the thumbnail depends on the
230 % reduction factor. The use of the ``thumbnail'' option implies
231 % the ``external'' option.
234 % \htmlimage{scale=1.5,external,thumbnail=0.2}
235 % will cause a small thumbnail image 1/5th of the original size to be
236 % placed in the final document, pointing to an external image 1.5
237 % times bigger than the original.
239 \newcommand{\htmlimage}[1]{}
241 %%% HTMLADDTONAVIGATION
242 % This command appends its argument to the buttons in the navigation
243 % panel. It is ignored by LaTeX.
246 % \htmladdtonavigation{\htmladdnormallink
247 % {\htmladdimg{http://server/path/to/gif}}
248 % {http://server/path}}
249 \newcommand{\htmladdtonavigation}[1]{}
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253 %%% JCL - stop input here if LaTeX2e is not present
254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
256 \ifx\if@compatibility
\undefined
258 \makeatother\relax\expandafter\endinput
261 %LaTeX2e in LaTeX209 compatibility mode
262 \makeatother\relax\expandafter\endinput
266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268 % Start providing LaTeX2e extension:
270 % - additional optional argument for \htmladdimg
271 % - support for segmented documents
275 \ProvidesPackage{html
}
276 [1996/
02/
01 v1.0 hypertext commands for latex2html (nd, hws)
]
279 % This command takes as argument a URL pointing to an image.
280 % The image will be embedded in the HTML document but will
281 % be ignored in the dvi and ps files. The optional argument
282 % denotes additional HTML tags.
284 % Example: \htmladdimg[ALT="portrait" ALIGN=CENTER]{portrait.gif}
286 \renewcommand{\htmladdimg}[2][]{}
288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290 % The following commands pertain to document segmentation, and
291 % were added by Herbert Swan <dprhws@edp.Arco.com> (with help from
292 % Michel Goossens <goossens@cern.ch>):
295 % This command inputs internal latex2html tables so that large
296 % documents can to partitioned into smaller (more manageable)
299 \newcommand{\internal}[2][internals
]{}
302 % Define a dummy stub \htmlhead{}. This command causes latex2html
303 % to define the title of the start of a new segment. It is not
304 % normally placed in the user's document. Rather, it is passed to
305 % latex2html via a .ptr file written by \segment.
307 \newcommand{\htmlhead}[2]{}
310 % The dummy command \endpreamble is needed by latex2html to
311 % mark the end of the preamble in document segments that do
312 % not contain a \begin{document}
314 \newcommand{\startdocument}{}
317 % Allocate a new set of section counters, which will get incremented
318 % for "*" forms of sectioning commands, and for a few miscellaneous
324 \newcounter{lchapter
}[part
]
325 \@ifundefined
{chapter
}{\newcounter{lsection
}[part
]}{\newcounter{lsection
}[chapter
]}
326 \newcounter{lsubsection
}[section
]
327 \newcounter{lsubsubsection
}[subsection
]
328 \newcounter{lparagraph
}[subsubsection
]
329 \newcounter{lsubparagraph
}[paragraph
]
330 \newcounter{lsubsubparagraph
}[subparagraph
]
331 \newcounter{lequation
}
333 % Redefine "*" forms of sectioning commands to increment their
334 % respective counters.
337 \let\Hchapter=
\chapter
338 \let\Hsection=
\section
339 \let\Hsubsection=
\subsection
340 \let\Hsubsubsection=
\subsubsection
341 \let\Hparagraph=
\paragraph
342 \let\Hsubparagraph=
\subparagraph
343 \let\Hsubsubparagraph=
\subsubparagraph
346 % The following definitions are specific to LaTeX2e:
347 % (They must be commented out for LaTeX 2.09)
349 \def\part{\@ifstar
{\stepcounter{lpart
}\Hpart*
}{\Hpart}}
350 \ifx\Hchapter\relax\else\@ifundefined
{chapter
}{}{%
351 \def\chapter{\resetsubsections \@ifstar
{\stepcounter{lchapter
}\Hchapter*
}{\Hchapter}}}
353 \def\section{\resetsubsubsections \@ifstar
{\stepcounter{lsection
}\Hsection*
}{\Hsection}}
354 \def\subsection{\resetparagraphs
355 \@ifstar
{\stepcounter{lsubsection
}\Hsubsection*
}{\Hsubsection}}
356 \def\subsubsection{\resetsubparagraphs
357 \@ifstar
{\stepcounter{lsubsubsection
}\Hsubsubsection*
}{\Hsubsubsection}}
358 \def\paragraph{\resetsubsubparagraphs
359 \@ifstar
{\stepcounter{lparagraph
}\Hparagraph*
}{\Hparagraph}}
361 \@ifstar
{\stepcounter{lsubparagraph
}\Hsubparagraph*
}{\Hsubparagraph}}
362 \def\subsubparagraph{%
363 \@ifstar
{\stepcounter{lsubsubparagraph
}\Hsubsubparagraph*
}{\Hsubsubparagraph}}
365 \def\resetsections{\setcounter{section
}{0}\setcounter{lsection
}{0}%
366 \reset@dependents
{section
}\resetsubsections }
367 \def\resetsubsections{\setcounter{subsection
}{0}\setcounter{lsubsection
}{0}%
368 \reset@dependents
{subsection
}\resetsubsubsections }
369 \def\resetsubsubsections{\setcounter{subsubsection
}{0}\setcounter{lsubsubsection
}{0}%
370 \reset@dependents
{subsubsection
}\resetparagraphs }
372 \def\resetparagraphs{\setcounter{lparagraph
}{0}\setcounter{lparagraph
}{0}%
373 \reset@dependents
{paragraph
}\resetsubparagraphs }
374 \def\resetsubparagraphs{\setcounter{subparagraph
}{0}\setcounter{lsubparagraph
}{0}%
375 \reset@dependents
{subparagraph
}\resetsubsubparagraphs }
376 \def\resetsubsubparagraphs{%\setcounter{subsubparagraph}{0}%
377 \setcounter{lsubsubparagraph
}{0}}
379 \def\reset@dependents
#1{\begingroup\let \@elt \@stpelt
\csname cl@
#1\endcsname\endgroup}
382 % Define a helper macro to dump a single \secounter command to a file.
384 \newcommand{\DumpPtr}[2]{%
385 \count255=
\arabic{#1}\advance\count255 by
\arabic{#2}%
386 \immediate\write\ptrfile{%
387 \noexpand\setcounter{#1}{\number\count255}}}
390 % Define a helper macro to dump all counters to the file.
391 % The value for each counter will be the sum of the l-counter
392 % actual LaTeX section counter.
393 % Also dump an \htmlhead{section-command}{section title} command
397 \def\DumpCounters#1#2#3{%
398 \begingroup\let\protect=
\noexpand
399 \immediate\openout\ptrfile =
#1.ptr
400 \DumpPtr{part
}{lpart
}%
401 \ifx\Hchapter\relax\else\DumpPtr{chapter
}{lchapter
}\fi
402 \DumpPtr{section
}{lsection
}%
403 \DumpPtr{subsection
}{lsubsection
}%
404 \DumpPtr{subsubsection
}{lsubsubsection
}%
405 \DumpPtr{paragraph
}{lparagraph
}%
406 \DumpPtr{subparagraph
}{lsubparagraph
}%
407 \DumpPtr{equation
}{lequation
}%
408 \immediate\write\ptrfile{\noexpand\htmlhead{#2}{#3}}%
409 \ifx\undefined\citeindextrue\else\expandafter\dumpcitestatus\fi
410 \ifx\undefined\current@
color\else\expandafter\dumpcurrentcolor\fi
411 \immediate\closeout\ptrfile
414 \def\dumpcitestatus{%
415 \ifciteindex\immediate\write\ptrfile{\noexpand\citeindextrue}%
416 \else\immediate\write\ptrfile{\noexpand\citeindexfalse}\fi }
418 \def\dumpcurrentcolor{%
419 \immediate\write\ptrfile{\noexpand\segmentcolor{\current@
color}}}
422 % Define the \segment{file}{section-command}{section-title} command,
423 % and its helper macros. This command does four things:
424 % 1) Begins a new LaTeX section;
425 % 2) Writes a list of section counters to file.ptr, each
426 % of which represents the sum of the LaTeX section
427 % counters, and the l-counters, defined above;
428 % 3) Write an \htmlhead{section-title} command to file.ptr;
429 % 4) Inputs file.tex.
433 \def\segment{\@ifstar
{\@@htmls
}{\@@html
}}
434 \def\@@htmls
#1#2#3{\csname #2\endcsname*
{#3}%
435 \DumpCounters{#1}{#2*
}{#3}\input{#1}}
436 \def\@@html
#1#2#3{\csname #2\endcsname {#3}%
437 \DumpCounters{#1}{#2}{#3}\input{#1}}