1 % LaTeX2HTML Version 0.6.4 : html.sty
2 %
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
7 % raw HTML.
8 % This file includes the comments.sty file v2.0 by Victor Eijkhout
9 % In most cases these commands do nothing when processed by LaTeX.
10
11 % Modifications:
12 %
13 % nd = Nikos Drakos <nikos@cbl.leeds.ac.uk>
14 % jz = Jelle van Zeijl <jvzeijl@isou17.estec.esa.nl>
15
16 % jz 22-APR-94 - Added support for htmlref
17 % nd - Created
18
19
20
21 % Exit if the style file is already loaded
22 % (suggested by Lee Shombert <las@potomac.wash.inmet.com>
23 \ifx \htmlstyloaded\relax \endinput\else\let\htmlstyloaded\relax\fi
24
25 %%% LINKS TO EXTERNAL DOCUMENTS
26 %
27 % This can be used to provide links to arbitrary documents.
28 % The first argumment should be the text that is going to be
29 % highlighted and the second argument a URL.
30 % The hyperlink will appear as a hyperlink in the HTML
31 % document and as a footnote in the dvi or ps files.
32 %
33 \newcommand{\htmladdnormallinkfoot}[2]{ #1\footnote{#2}}
34
35 % This is an alternative definition of the command above which
36 % will ignore the URL in the dvi or ps files.
37 \newcommand{\htmladdnormallink}[2]{ #1 }
38
39 % This command takes as argument a URL pointing to an image.
40 % The image will be embedded in the HTML document but will
41 % be ignored in the dvi and ps files.
42 %
43 \newcommand{\htmladdimg}[1]{ }
44
45 %%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS
46 %
47 % This can be used to refer to symbolic labels in other Latex
48 % documents that have already been processed by the translator.
49 % The arguments should be:
50 % #1 : the URL to the directory containing the external document
51 % #2 : the path to the labels.pl file of the external document.
52 % If the external document lives on a remote machine then labels.pl
53 % must be copied on the local machine.
54 %
55 %e.g. \externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html}
56 % {/usr/cblelca/nikos/tmp/labels.pl}
57 % The arguments are ignored in the dvi and ps files.
58 %
59 \newcommand{\externallabels}[2]{ }
60
61 % This complements the \externallabels command above. The argument
62 % should be a label defined in another latex document and will be
63 % ignored in the dvi and ps files.
64 %
65 \newcommand{\externalref}[1]{ }
66
67
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 % Comment.sty version 2.0, 19 June 1992
70 % selectively in/exclude pieces of text: the user can define new
71 % comment versions, and each is controlled separately.
72 % This style can be used with plain TeX or LaTeX, and probably
73 % most other packages too.
74 %
75 % Examples of use in LaTeX and TeX follow \endinput
76 %
77 % Author
78 % Victor Eijkhout
79 % Department of Computer Science
80 % University Tennessee at Knoxville
81 % 104 Ayres Hall
82 % Knoxville, TN 37996
83 % USA
84 %
85 % eijkhout@cs.utk.edu
86 %
87 % Usage: all text included in between
88 % \comment ... \endcomment
89 % or \begin{comment} ... \end{comment}
90 % is discarded. The closing command should appear on a line
91 % of its own. No starting spaces, nothing after it.
92 % This environment should work with arbitrary amounts
93 % of comment.
94 %
95 % Other 'comment' environments are defined by
96 % and are selected/deselected with
97 % \includecomment{versiona}
98 % \excludecoment{versionb}
99 %
100 % These environments are used as
101 % \versiona ... \endversiona
102 % or \begin{versiona} ... \end{versiona}
103 % with the closing command again on a line of its own.
104 %
105 % Basic approach:
106 % to comment something out, scoop up every line in verbatim mode
107 % as macro argument, then throw it away.
108 % For inclusions, both the opening and closing comands
109 % are defined as noop
110 %
111 % Changed \next to \html@next to prevent clashes with other sty files
112 % (mike@emn.fr)
113 % Changed \html@next to \htmlnext so the \makeatletter and
114 % \makeatother commands could be removed (they were causing other
115 % style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
116
117
118 \def\makeinnocent#1{\catcode`#1=12 }
119 \def\csarg#1#2{\expandafter#1\csname#2\endcsname}
120
121 \def\ThrowAwayComment#1{\begingroup
122 \def\CurrentComment{#1}%
123 \let\do\makeinnocent \dospecials
124 \makeinnocent\^^L% and whatever other special cases
125 \endlinechar`\^^M \catcode`\^^M=12 \xComment}
126 {\catcode`\^^M=12 \endlinechar=-1 %
127 \gdef\xComment#1^^M{\def\test{#1}
128 \csarg\ifx{PlainEnd\CurrentComment Test}\test
129 \let\htmlnext\endgroup
130 \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
131 \edef\htmlnext{\endgroup\noexpand\end{\CurrentComment}}
132 \else \let\htmlnext\xComment
133 \fi \fi \htmlnext}
134 }
135
136 \def\includecomment
137 #1{\expandafter\def\csname#1\endcsname{}%
138 \expandafter\def\csname end#1\endcsname{}}
139 \def\excludecomment
140 #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
141 {\escapechar=-1\relax
142 \csarg\xdef{PlainEnd#1Test}{\string\\end#1}%
143 \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}%
144 }}
145
146 \excludecomment{comment}
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148
149 %%% RAW HTML
150 %
151 % Enclose raw HTML between a \begin{rawhtml} and \end{rawhtml}.
152 % The html environment ignores its body
153 %
154 \excludecomment{rawhtml}
155
156 %%% HTML ONLY
157 %
158 % Enclose LaTeX constructs which will only appear in the
159 % HTML output and will be ignored by LaTeX with
160 % \begin{htmlonly} and \end{htmlonly}
161 %
162 \excludecomment{htmlonly}
163
164 %%% LaTeX ONLY
165 % Enclose LaTeX constructs which will only appear in the
166 % DVI output and will be ignored by latex2html with
167 %\begin{latexonly} and \end{latexonly}
168 %
169 \newenvironment{latexonly}{}{}
170
171 %%% HYPERREF
172 % Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm>
173 % Similar to \ref but accepts conditional text.
174 % The first argument is HTML text which will become ``hyperized''
175 % (underlined).
176 % The second and third arguments are text which will appear only in the paper
177 % version (DVI file), enclosing the fourth argument which is a reference to a label.
178 %
179 %e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace}
180 % where there is a corresponding \label{trace}
181 %
182 \newcommand{\hyperref}[4]{#2\ref{#4}#3}
183
184 %%% HTMLREF
185 % Reference in HTML version only.
186 % Mix between \htmladdnormallink and \hyperref.
187 % First arg is text for in both versions, second is label for use in HTML
188 % version.
189 \newcommand{\htmlref}[2]{#1}
190
191 %%% HTMLIMAGE
192 % This command can be used inside any environment that is converted
193 % into an inlined image (eg a "figure" environment) in order to change
194 % the way the image will be translated. The argument of \htmlimage
195 % is really a string of options separated by commas ie
196 % [scale=<scale factor>],[external],[thumbnail=<reduction factor>
197 % The scale option allows control over the size of the final image.
198 % The ``external'' option will cause the image not to be inlined
199 % (images are inlined by default). External images will be accessible
200 % via a hypertext link.
201 % The ``thumbnail'' option will cause a small inlined image to be
202 % placed in the caption. The size of the thumbnail depends on the
203 % reduction factor. The use of the ``thumbnail'' option implies
204 % the ``external'' option.
205 %
206 % Example:
207 % \htmlimage{scale=1.5,external,thumbnail=0.2}
208 % will cause a small thumbnail image 1/5th of the original size to be
209 % placed in the final document, pointing to an external image 1.5
210 % times bigger than the original.
211 %
212 \newcommand{\htmlimage}[1]{}
213
214 %%% HTMLADDTONAVIGATION
215 % This command appends its argument to the buttons in the navigation
216 % panel. It is ignored by LaTeX.
217 %
218 % Example:
219 % \htmladdtonavigation{\htmladdnormallink
220 % {\htmladdimg{http://server/path/to/gif}}
221 % {http://server/path}}
222 \newcommand{\htmladdtonavigation}[1]{}
223