blob: 191bb19f4c1a2bd87dc8a14306e5b02115afb040 [file] [log] [blame]
Austin Schuh405fa6c2015-09-06 18:13:55 -07001% LaTeX2HTML Version 95.1 : html.sty
2%
3% WARNING: This file requires LaTeX2e. A LaTeX 2.09 version
4% is also provided, but with restricted functionality.
5%
6% This file contains definitions of LaTeX commands which are
7% processed in a special way by the translator.
8% For example, there are commands for embedding external hypertext links,
9% for cross-references between documents or for including
10% raw HTML.
11% This file includes the comments.sty file v2.0 by Victor Eijkhout
12% In most cases these commands do nothing when processed by LaTeX.
13
14% Modifications:
15%
16% nd = Nikos Drakos <nikos@cbl.leeds.ac.uk>
17% jz = Jelle van Zeijl <jvzeijl@isou17.estec.esa.nl>
18% hs = Herb Swan <dprhws@edp.Arco.com>
19
20% hs 31-JAN-96 - Added support for document segmentation
21% hs 10-OCT-95 - Added \htmlrule command
22% jz 22-APR-94 - Added support for htmlref
23% nd - Created
24%%%%MG added
25\NeedsTeXFormat{LaTeX2e}
26\ProvidesPackage{html}
27 [1996/02/01 v1.0 hypertext commands for latex2html (nd, hs)]
28%%%%MG
29% Exit if the style file is already loaded
30% (suggested by Lee Shombert <las@potomac.wash.inmet.com>
31\ifx \htmlstyloaded\relax \endinput\else\let\htmlstyloaded\relax\fi
32
33%%% LINKS TO EXTERNAL DOCUMENTS
34%
35% This can be used to provide links to arbitrary documents.
36% The first argumment should be the text that is going to be
37% highlighted and the second argument a URL.
38% The hyperlink will appear as a hyperlink in the HTML
39% document and as a footnote in the dvi or ps files.
40%
41\newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}}
42
43% This is an alternative definition of the command above which
44% will ignore the URL in the dvi or ps files.
45\newcommand{\htmladdnormallink}[2]{#1}
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%%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS
54%
55% This can be used to refer to symbolic labels in other Latex
56% documents that have already been processed by the translator.
57% The arguments should be:
58% #1 : the URL to the directory containing the external document
59% #2 : the path to the labels.pl file of the external document.
60% If the external document lives on a remote machine then labels.pl
61% must be copied on the local machine.
62%
63%e.g. \externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html}
64% {/usr/cblelca/nikos/tmp/labels.pl}
65% The arguments are ignored in the dvi and ps files.
66%
67\newcommand{\externallabels}[2]{}
68
69%
70% This complements the \externallabels command above. The argument
71% should be a label defined in another latex document and will be
72% ignored in the dvi and ps files.
73%
74\newcommand{\externalref}[1]{}
75
76% This command adds a horizontal rule and is valid even within
77% a figure caption.
78%
79\newcommand{\htmlrule}{}
80
81%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82%
83% The following commands pertain to document segmentation, and
84% were added by Herbert Swan <dprhws@edp.Arco.com> (with help from
85% Michel Goossens <goossens@cern.ch>):
86%
87%
88% This command inputs internal latex2html tables so that large
89% documents can to partitioned into smaller (more manageable)
90% segments.
91%
92\newcommand{\internal}[2][internals]{}
93
94%
95% Define a dummy stub \htmlhead{}. This command causes latex2html
96% to define the title of the start of a new segment. It is not
97% normally placed in the user's document. Rather, it is passed to
98% latex2html via a .ptr file written by \segment.
99%
100\newcommand{\htmlhead}[2]{}
101
102%
103% The dummy command \endpreamble is needed by latex2html to
104% mark the end of the preamble in document segments that do
105% not contain a \begin{document}
106%
107\newcommand{\startdocument}{}
108
109%
110% Allocate a new set of section counters, which will get incremented
111% for "*" forms of sectioning commands, and for a few miscellaneous
112% commands.
113%
114
115\newcounter{lpart}
116\newcounter{lchapter}[part]
117\ifx\chapter\undefined\newcounter{lsection}[part]\else\newcounter{lsection}[chapter]\fi
118\newcounter{lsubsection}[section]
119\newcounter{lsubsubsection}[subsection]
120\newcounter{lparagraph}[subsubsection]
121\newcounter{lsubparagraph}[paragraph]
122\newcounter{lsubsubparagraph}[subparagraph]
123\newcounter{lequation}
124%
125% Redefine "*" forms of sectioning commands to increment their
126% respective counters.
127%
128\let\Hpart=\part
129\let\Hchapter=\chapter
130\let\Hsection=\section
131\let\Hsubsection=\subsection
132\let\Hsubsubsection=\subsubsection
133\let\Hparagraph=\paragraph
134\let\Hsubparagraph=\subparagraph
135\let\Hsubsubparagraph=\subsubparagraph
136
137%
138% The following definitions are specific to LaTeX2e:
139% (They must be commented out for LaTeX 2.09)
140%
141\def\part{\@ifstar{\stepcounter{lpart}\Hpart*}{\Hpart}}
142\def\chapter{\@ifstar{\stepcounter{lchapter}\Hchapter*}{\Hchapter}}
143\def\section{\@ifstar{\stepcounter{lsection}\Hsection*}{\Hsection}}
144\def\subsection{\@ifstar{\stepcounter{lsubsection}\Hsubsection*}{\Hsubsection}}
145\def\subsubsection{\@ifstar{\stepcounter{lsubsubsection}\Hsubsubsection*}{\Hsubsubsection}}
146\def\paragraph{\@ifstar{\stepcounter{lparagraph}\Hparagraph*}{\Hparagraph}}
147\def\subparagraph{\@ifstar{\stepcounter{lsubparagraph}\Hsubparagraph*}{\Hsubparagraph}}
148\def\subsubparagraph{\@ifstar{\stepcounter{lsubsubparagraph}\Hsubsubparagraph*}{\Hsubsubparagraph}}
149%
150% Define a helper macro to dump a single \secounter command to a file.
151%
152\newcommand{\DumpPtr}[2]{%
153\count255=\arabic{#1} \advance\count255 by \arabic{#2}
154\immediate\write\ptrfile{%
155\noexpand\setcounter{#1}{\number\count255}}}
156
157%
158% Define a helper macro to dump all counters to the file.
159% The value for each counter will be the sum of the l-counter
160% actual LaTeX section counter.
161% Also dump an \htmlhead{section-command}{section title} command
162% to the file.
163%
164
165\def\DumpCounters#1#2#3{\newwrite\ptrfile
166\immediate\openout\ptrfile = #1.ptr
167\DumpPtr{part}{lpart}
168\ifx\Hchapter\undefined\relax\else\DumpPtr{chapter}{lchapter}\fi
169\DumpPtr{section}{lsection}
170\DumpPtr{subsection}{lsubsection}
171\DumpPtr{subsubsection}{lsubsubsection}
172\DumpPtr{paragraph}{lparagraph}
173\DumpPtr{subparagraph}{lsubparagraph}
174\DumpPtr{equation}{lequation}
175\immediate\write\ptrfile{\noexpand\htmlhead{#2}{#3}}
176\immediate\closeout\ptrfile}
177
178%
179% Define the \segment{file}{section-command}{section-title} command,
180% and its helper macros. This command does four things:
181% 1) Begins a new LaTeX section;
182% 2) Writes a list of section counters to file.ptr, each
183% of which represents the sum of the LaTeX section
184% counters, and the l-counters, defined above;
185% 3) Write an \htmlhead{section-title} command to file.ptr;
186% 4) Inputs file.tex.
187%
188
189%%%%MG changed
190\def\segment{\@ifstar{\@@htmls}{\@@html}}
191\def\@@htmls#1#2#3{\csname #2\endcsname* {#3}%
192 \DumpCounters{#1}{#2*}{#3}\input{#1}}
193\def\@@html#1#2#3{\csname #2\endcsname {#3}%
194 \DumpCounters{#1}{#2}{#3}\input{#1}}
195%%%%MG
196
197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198% Comment.sty version 2.0, 19 June 1992
199% selectively in/exclude pieces of text: the user can define new
200% comment versions, and each is controlled separately.
201% This style can be used with plain TeX or LaTeX, and probably
202% most other packages too.
203%
204% Examples of use in LaTeX and TeX follow \endinput
205%
206% Author
207% Victor Eijkhout
208% Department of Computer Science
209% University Tennessee at Knoxville
210% 104 Ayres Hall
211% Knoxville, TN 37996
212% USA
213%
214% eijkhout@cs.utk.edu
215%
216% Usage: all text included in between
217% \comment ... \endcomment
218% or \begin{comment} ... \end{comment}
219% is discarded. The closing command should appear on a line
220% of its own. No starting spaces, nothing after it.
221% This environment should work with arbitrary amounts
222% of comment.
223%
224% Other 'comment' environments are defined by
225% and are selected/deselected with
226% \includecomment{versiona}
227% \excludecoment{versionb}
228%
229% These environments are used as
230% \versiona ... \endversiona
231% or \begin{versiona} ... \end{versiona}
232% with the closing command again on a line of its own.
233%
234% Basic approach:
235% to comment something out, scoop up every line in verbatim mode
236% as macro argument, then throw it away.
237% For inclusions, both the opening and closing comands
238% are defined as noop
239%
240% Changed \next to \html@next to prevent clashes with other sty files
241% (mike@emn.fr)
242% Changed \html@next to \htmlnext so the \makeatletter and
243% \makeatother commands could be removed (they were causing other
244% style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
245% Changed \htmlnext back to \html@next...
246
247\makeatletter
248\def\makeinnocent#1{\catcode`#1=12 }
249\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
250
251\def\ThrowAwayComment#1{\begingroup
252 \def\CurrentComment{#1}%
253 \let\do\makeinnocent \dospecials
254 \makeinnocent\^^L% and whatever other special cases
255 \endlinechar`\^^M \catcode`\^^M=12 \xComment}
256{\catcode`\^^M=12 \endlinechar=-1 %
257 \gdef\xComment#1^^M{\def\test{#1}
258 \csarg\ifx{PlainEnd\CurrentComment Test}\test
259 \let\html@next\endgroup
260 \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
261 \edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
262 \else \let\html@next\xComment
263 \fi \fi \html@next}
264}
265\makeatother
266
267\def\includecomment
268 #1{\expandafter\def\csname#1\endcsname{}%
269 \expandafter\def\csname end#1\endcsname{}}
270\def\excludecomment
271 #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
272 {\escapechar=-1\relax
273 \csarg\xdef{PlainEnd#1Test}{\string\\end#1}%
274 \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}%
275 }}
276
277\excludecomment{comment}
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279
280%%% RAW HTML
281%
282% Enclose raw HTML between a \begin{rawhtml} and \end{rawhtml}.
283% The html environment ignores its body
284%
285\excludecomment{rawhtml}
286
287%%% HTML ONLY
288%
289% Enclose LaTeX constructs which will only appear in the
290% HTML output and will be ignored by LaTeX with
291% \begin{htmlonly} and \end{htmlonly}
292%
293\excludecomment{htmlonly}
294% Shorter version
295\newcommand{\html}[1]{}
296
297
298%%% LaTeX ONLY
299% Enclose LaTeX constructs which will only appear in the
300% DVI output and will be ignored by latex2html with
301%\begin{latexonly} and \end{latexonly}
302%
303\newenvironment{latexonly}{}{}
304% Shorter version
305\newcommand{\latex}[1]{#1}
306
307%%% HYPERREF
308% Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm>
309% Similar to \ref but accepts conditional text.
310% The first argument is HTML text which will become ``hyperized''
311% (underlined).
312% The second and third arguments are text which will appear only in the paper
313% version (DVI file), enclosing the fourth argument which is a reference to a label.
314%
315%e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace}
316% where there is a corresponding \label{trace}
317%
318\newcommand{\hyperref}[4]{#2\ref{#4}#3}
319
320%%% HTMLREF
321% Reference in HTML version only.
322% Mix between \htmladdnormallink and \hyperref.
323% First arg is text for in both versions, second is label for use in HTML
324% version.
325\newcommand{\htmlref}[2]{#1}
326
327%%% HTMLIMAGE
328% This command can be used inside any environment that is converted
329% into an inlined image (eg a "figure" environment) in order to change
330% the way the image will be translated. The argument of \htmlimage
331% is really a string of options separated by commas ie
332% [scale=<scale factor>],[external],[thumbnail=<reduction factor>
333% The scale option allows control over the size of the final image.
334% The ``external'' option will cause the image not to be inlined
335% (images are inlined by default). External images will be accessible
336% via a hypertext link.
337% The ``thumbnail'' option will cause a small inlined image to be
338% placed in the caption. The size of the thumbnail depends on the
339% reduction factor. The use of the ``thumbnail'' option implies
340% the ``external'' option.
341%
342% Example:
343% \htmlimage{scale=1.5,external,thumbnail=0.2}
344% will cause a small thumbnail image 1/5th of the original size to be
345% placed in the final document, pointing to an external image 1.5
346% times bigger than the original.
347%
348\newcommand{\htmlimage}[1]{}
349
350%%% HTMLADDTONAVIGATION
351% This command appends its argument to the buttons in the navigation
352% panel. It is ignored by LaTeX.
353%
354% Example:
355% \htmladdtonavigation{\htmladdnormallink
356% {\htmladdimg{http://server/path/to/gif}}
357% {http://server/path}}
358\newcommand{\htmladdtonavigation}[1]{}
359
360\endinput