html.sty
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:15k
- % LaTeX2HTML Version 96.1 : html.sty
- %
- % This file contains definitions of LaTeX commands which are
- % processed in a special way by the translator.
- % For example, there are commands for embedding external hypertext links,
- % for cross-references between documents or for including raw HTML.
- % This file includes the comments.sty file v2.0 by Victor Eijkhout
- % In most cases these commands do nothing when processed by LaTeX.
- %
- % Place this file in a directory accessible to LaTeX (i.e., somewhere
- % in the TEXINPUTS path.)
- %
- % NOTE: This file works with LaTeX 2.09 or (the newer) LaTeX2e.
- % If you only have LaTeX 2.09, some complex LaTeX2HTML features
- % like support for segmented documents are not available.
- % Modifications:
- %
- % (The listing of Initiales see Changes)
- % jcl 30-SEP-96
- % - Stuck the commands commonly used by both LaTeX versions to the top,
- % added a check which stops input or reads further if the document
- % makes use of LaTeX2e.
- % - Introduced rrm's dumpcurrentcolor and bodytext
- % hws 31-JAN-96 - Added support for document segmentation
- % hws 10-OCT-95 - Added htmlrule command
- % jz 22-APR-94 - Added support for htmlref
- % nd - Created
- % Exit if the style file is already loaded
- % (suggested by Lee Shombert <las@potomac.wash.inmet.com>
- ifx htmlstyloadedrelax endinputelselethtmlstyloadedrelaxfi
- %%% LINKS TO EXTERNAL DOCUMENTS
- %
- % This can be used to provide links to arbitrary documents.
- % The first argumment should be the text that is going to be
- % highlighted and the second argument a URL.
- % The hyperlink will appear as a hyperlink in the HTML
- % document and as a footnote in the dvi or ps files.
- %
- newcommand{htmladdnormallinkfoot}[2]{#1footnote{#2}}
- % This is an alternative definition of the command above which
- % will ignore the URL in the dvi or ps files.
- newcommand{htmladdnormallink}[2]{#1}
- % This command takes as argument a URL pointing to an image.
- % The image will be embedded in the HTML document but will
- % be ignored in the dvi and ps files.
- %
- newcommand{htmladdimg}[1]{}
- %%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS
- %
- % This can be used to refer to symbolic labels in other Latex
- % documents that have already been processed by the translator.
- % The arguments should be:
- % #1 : the URL to the directory containing the external document
- % #2 : the path to the labels.pl file of the external document.
- % If the external document lives on a remote machine then labels.pl
- % must be copied on the local machine.
- %
- %e.g. externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html}
- % {/usr/cblelca/nikos/tmp/labels.pl}
- % The arguments are ignored in the dvi and ps files.
- %
- newcommand{externallabels}[2]{}
- %
- % This complements the externallabels command above. The argument
- % should be a label defined in another latex document and will be
- % ignored in the dvi and ps files.
- %
- newcommand{externalref}[1]{}
- % This command adds a horizontal rule and is valid even within
- % a figure caption.
- %
- newcommand{htmlrule}{}
- % This command adds information within the <BODY> ... </BODY> tag
- %
- newcommand{bodytext}[1]{}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Comment.sty version 2.0, 19 June 1992
- % selectively in/exclude pieces of text: the user can define new
- % comment versions, and each is controlled separately.
- % This style can be used with plain TeX or LaTeX, and probably
- % most other packages too.
- %
- % Examples of use in LaTeX and TeX follow endinput
- %
- % Author
- % Victor Eijkhout
- % Department of Computer Science
- % University Tennessee at Knoxville
- % 104 Ayres Hall
- % Knoxville, TN 37996
- % USA
- %
- % eijkhout@cs.utk.edu
- %
- % Usage: all text included in between
- % comment ... endcomment
- % or begin{comment} ... end{comment}
- % is discarded. The closing command should appear on a line
- % of its own. No starting spaces, nothing after it.
- % This environment should work with arbitrary amounts
- % of comment.
- %
- % Other 'comment' environments are defined by
- % and are selected/deselected with
- % includecomment{versiona}
- % excludecoment{versionb}
- %
- % These environments are used as
- % versiona ... endversiona
- % or begin{versiona} ... end{versiona}
- % with the closing command again on a line of its own.
- %
- % Basic approach:
- % to comment something out, scoop up every line in verbatim mode
- % as macro argument, then throw it away.
- % For inclusions, both the opening and closing comands
- % are defined as noop
- %
- % Changed next to html@next to prevent clashes with other sty files
- % (mike@emn.fr)
- % Changed html@next to htmlnext so the makeatletter and
- % makeatother commands could be removed (they were causing other
- % style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
- % Changed htmlnext back to html@next...
- makeatletter
- defmakeinnocent#1{catcode`#1=12 }
- defcsarg#1#2{expandafter#1csname#2endcsname}
- defThrowAwayComment#1{begingroup
- defCurrentComment{#1}%
- letdomakeinnocent dospecials
- makeinnocent^^L% and whatever other special cases
- endlinechar`^^M catcode`^^M=12 xComment}
- {catcode`^^M=12 endlinechar=-1 %
- gdefxComment#1^^M{deftest{#1}
- csargifx{PlainEndCurrentComment Test}test
- lethtml@nextendgroup
- else csargifx{LaLaEndCurrentComment Test}test
- edefhtml@next{endgroupnoexpandend{CurrentComment}}
- else lethtml@nextxComment
- fi fi html@next}
- }
- makeatother
- defincludecomment
- #1{expandafterdefcsname#1endcsname{}%
- expandafterdefcsname end#1endcsname{}}
- defexcludecomment
- #1{expandafterdefcsname#1endcsname{ThrowAwayComment{#1}}%
- {escapechar=-1relax
- csargxdef{PlainEnd#1Test}{string\end#1}%
- csargxdef{LaLaEnd#1Test}{string\endstring{#1string}}%
- }}
- excludecomment{comment}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%% RAW HTML
- %
- % Enclose raw HTML between a begin{rawhtml} and end{rawhtml}.
- % The html environment ignores its body
- %
- excludecomment{rawhtml}
- %%% HTML ONLY
- %
- % Enclose LaTeX constructs which will only appear in the
- % HTML output and will be ignored by LaTeX with
- % begin{htmlonly} and end{htmlonly}
- %
- excludecomment{htmlonly}
- % Shorter version
- newcommand{html}[1]{}
- %%% LaTeX ONLY
- % Enclose LaTeX constructs which will only appear in the
- % DVI output and will be ignored by latex2html with
- %begin{latexonly} and end{latexonly}
- %
- newenvironment{latexonly}{}{}
- % Shorter version
- newcommand{latex}[1]{#1}
- %%% HYPERREF
- % Suggested by Eric M. Carol <eric@ca.utoronto.utcc.enfm>
- % Similar to ref but accepts conditional text.
- % The first argument is HTML text which will become ``hyperized''
- % (underlined).
- % The second and third arguments are text which will appear only in the paper
- % version (DVI file), enclosing the fourth argument which is a reference to a label.
- %
- %e.g. hyperref{using the tracer}{using the tracer (see Section}{)}{trace}
- % where there is a corresponding label{trace}
- %
- newcommand{hyperref}[4]{#2ref{#4}#3}
- %%% HTMLREF
- % Reference in HTML version only.
- % Mix between htmladdnormallink and hyperref.
- % First arg is text for in both versions, second is label for use in HTML
- % version.
- newcommand{htmlref}[2]{#1}
- %%% HTMLIMAGE
- % This command can be used inside any environment that is converted
- % into an inlined image (eg a "figure" environment) in order to change
- % the way the image will be translated. The argument of htmlimage
- % is really a string of options separated by commas ie
- % [scale=<scale factor>],[external],[thumbnail=<reduction factor>
- % The scale option allows control over the size of the final image.
- % The ``external'' option will cause the image not to be inlined
- % (images are inlined by default). External images will be accessible
- % via a hypertext link.
- % The ``thumbnail'' option will cause a small inlined image to be
- % placed in the caption. The size of the thumbnail depends on the
- % reduction factor. The use of the ``thumbnail'' option implies
- % the ``external'' option.
- %
- % Example:
- % htmlimage{scale=1.5,external,thumbnail=0.2}
- % will cause a small thumbnail image 1/5th of the original size to be
- % placed in the final document, pointing to an external image 1.5
- % times bigger than the original.
- %
- newcommand{htmlimage}[1]{}
- %%% HTMLADDTONAVIGATION
- % This command appends its argument to the buttons in the navigation
- % panel. It is ignored by LaTeX.
- %
- % Example:
- % htmladdtonavigation{htmladdnormallink
- % {htmladdimg{http://server/path/to/gif}}
- % {http://server/path}}
- newcommand{htmladdtonavigation}[1]{}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%% JCL - stop input here if LaTeX2e is not present
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- makeatletter
- ifxif@compatibilityundefined
- %LaTeX209
- makeatotherrelaxexpandafterendinput
- fi
- if@compatibility
- %LaTeX2e in LaTeX209 compatibility mode
- makeatotherrelaxexpandafterendinput
- fi
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Start providing LaTeX2e extension:
- % This is currently:
- % - additional optional argument for htmladdimg
- % - support for segmented documents
- %
- ProvidesPackage{html}
- [1996/02/01 v1.0 hypertext commands for latex2html (nd, hws)]
- %%%%MG
- % This command takes as argument a URL pointing to an image.
- % The image will be embedded in the HTML document but will
- % be ignored in the dvi and ps files. The optional argument
- % denotes additional HTML tags.
- %
- % Example: htmladdimg[ALT="portrait" ALIGN=CENTER]{portrait.gif}
- %
- renewcommand{htmladdimg}[2][]{}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % The following commands pertain to document segmentation, and
- % were added by Herbert Swan <dprhws@edp.Arco.com> (with help from
- % Michel Goossens <goossens@cern.ch>):
- %
- %
- % This command inputs internal latex2html tables so that large
- % documents can to partitioned into smaller (more manageable)
- % segments.
- %
- newcommand{internal}[2][internals]{}
- %
- % Define a dummy stub htmlhead{}. This command causes latex2html
- % to define the title of the start of a new segment. It is not
- % normally placed in the user's document. Rather, it is passed to
- % latex2html via a .ptr file written by segment.
- %
- newcommand{htmlhead}[2]{}
- %
- % The dummy command endpreamble is needed by latex2html to
- % mark the end of the preamble in document segments that do
- % not contain a begin{document}
- %
- newcommand{startdocument}{}
- %
- % Allocate a new set of section counters, which will get incremented
- % for "*" forms of sectioning commands, and for a few miscellaneous
- % commands.
- %
- makeatletter
- newcounter{lpart}
- newcounter{lchapter}[part]
- @ifundefined{chapter}{newcounter{lsection}[part]}{newcounter{lsection}[chapter]}
- newcounter{lsubsection}[section]
- newcounter{lsubsubsection}[subsection]
- newcounter{lparagraph}[subsubsection]
- newcounter{lsubparagraph}[paragraph]
- newcounter{lsubsubparagraph}[subparagraph]
- newcounter{lequation}
- %
- % Redefine "*" forms of sectioning commands to increment their
- % respective counters.
- %
- letHpart=part
- letHchapter=chapter
- letHsection=section
- letHsubsection=subsection
- letHsubsubsection=subsubsection
- letHparagraph=paragraph
- letHsubparagraph=subparagraph
- letHsubsubparagraph=subsubparagraph
- %
- % The following definitions are specific to LaTeX2e:
- % (They must be commented out for LaTeX 2.09)
- %
- defpart{@ifstar{stepcounter{lpart}Hpart*}{Hpart}}
- ifxHchapterrelaxelse@ifundefined{chapter}{}{%
- defchapter{resetsubsections @ifstar{stepcounter{lchapter}Hchapter*}{Hchapter}}}
- fi
- defsection{resetsubsubsections @ifstar{stepcounter{lsection}Hsection*}{Hsection}}
- defsubsection{resetparagraphs
- @ifstar{stepcounter{lsubsection}Hsubsection*}{Hsubsection}}
- defsubsubsection{resetsubparagraphs
- @ifstar{stepcounter{lsubsubsection}Hsubsubsection*}{Hsubsubsection}}
- defparagraph{resetsubsubparagraphs
- @ifstar{stepcounter{lparagraph}Hparagraph*}{Hparagraph}}
- defsubparagraph{%
- @ifstar{stepcounter{lsubparagraph}Hsubparagraph*}{Hsubparagraph}}
- defsubsubparagraph{%
- @ifstar{stepcounter{lsubsubparagraph}Hsubsubparagraph*}{Hsubsubparagraph}}
- %
- defresetsections{setcounter{section}{0}setcounter{lsection}{0}%
- reset@dependents{section}resetsubsections }
- defresetsubsections{setcounter{subsection}{0}setcounter{lsubsection}{0}%
- reset@dependents{subsection}resetsubsubsections }
- defresetsubsubsections{setcounter{subsubsection}{0}setcounter{lsubsubsection}{0}%
- reset@dependents{subsubsection}resetparagraphs }
- %
- defresetparagraphs{setcounter{lparagraph}{0}setcounter{lparagraph}{0}%
- reset@dependents{paragraph}resetsubparagraphs }
- defresetsubparagraphs{setcounter{subparagraph}{0}setcounter{lsubparagraph}{0}%
- reset@dependents{subparagraph}resetsubsubparagraphs }
- defresetsubsubparagraphs{%setcounter{subsubparagraph}{0}%
- setcounter{lsubsubparagraph}{0}}
- %
- defreset@dependents#1{begingrouplet @elt @stpelt csname cl@#1endcsnameendgroup}
- %
- %
- % Define a helper macro to dump a single secounter command to a file.
- %
- newcommand{DumpPtr}[2]{%
- count255=arabic{#1}advancecount255 by arabic{#2}%
- immediatewriteptrfile{%
- noexpandsetcounter{#1}{numbercount255}}}
- %
- % Define a helper macro to dump all counters to the file.
- % The value for each counter will be the sum of the l-counter
- % actual LaTeX section counter.
- % Also dump an htmlhead{section-command}{section title} command
- % to the file.
- %
- newwriteptrfile
- defDumpCounters#1#2#3{%
- begingroupletprotect=noexpand
- immediateopenoutptrfile = #1.ptr
- DumpPtr{part}{lpart}%
- ifxHchapterrelaxelseDumpPtr{chapter}{lchapter}fi
- DumpPtr{section}{lsection}%
- DumpPtr{subsection}{lsubsection}%
- DumpPtr{subsubsection}{lsubsubsection}%
- DumpPtr{paragraph}{lparagraph}%
- DumpPtr{subparagraph}{lsubparagraph}%
- DumpPtr{equation}{lequation}%
- immediatewriteptrfile{noexpandhtmlhead{#2}{#3}}%
- ifxundefinedciteindextrueelseexpandafterdumpcitestatusfi
- ifxundefinedcurrent@colorelseexpandafterdumpcurrentcolorfi
- immediatecloseoutptrfile
- endgroup }
- defdumpcitestatus{%
- ifciteindeximmediatewriteptrfile{noexpandciteindextrue}%
- elseimmediatewriteptrfile{noexpandciteindexfalse}fi }
- defdumpcurrentcolor{%
- immediatewriteptrfile{noexpandsegmentcolor{current@color}}}
- %
- % Define the segment{file}{section-command}{section-title} command,
- % and its helper macros. This command does four things:
- % 1) Begins a new LaTeX section;
- % 2) Writes a list of section counters to file.ptr, each
- % of which represents the sum of the LaTeX section
- % counters, and the l-counters, defined above;
- % 3) Write an htmlhead{section-title} command to file.ptr;
- % 4) Inputs file.tex.
- %
- %%%%MG changed
- defsegment{@ifstar{@@htmls}{@@html}}
- def@@htmls#1#2#3{csname #2endcsname* {#3}%
- DumpCounters{#1}{#2*}{#3}input{#1}}
- def@@html#1#2#3{csname #2endcsname {#3}%
- DumpCounters{#1}{#2}{#3}input{#1}}
- %%%%MG
- makeatother
- endinput