|
The "html" package (html.sty) can be very useful for
the times that you want to conditionally controlling the output in Latex
documents, but very specifically, when you want one set of output for normal
Latex processing, and another set of output for HTML processing.
Here's a very simple example of how you can use this package to conditionally
control what is output by the Latex processor:
\documentclass[a4paper,11pt]{article}
\author{Al Alexander}
\title{}
\usepackage{html}
\begin{document}
\maketitle
\tableofcontents
% print this output when processing by a Latex-only processor (like "pdflatex"):
\latex{This document has been processed by something like pdflatex.}
% longer latex example
\begin{latexonly}
Some more PDF text here.
Something longer than you want to include in a
simple command, something like this
multiline example.
\end{latexonly}
% when processing this doc using Latex2HTML do this:
\html{<p>This document has been processed by something like Latex2HTML.</p>}
% longer html example
\begin{htmlonly}
<pre>
Some more HTML text here.
Something longer than you want to include in a
simple command, something like this
multiline example.
</pre>
\end{htmlonly}
\end{document}
In this example the PDF document that results when I run pdflatex
has this output:
This document has been processed by something like pdflatex.
Some more PDF text here.
Something longer than you want to include in a
simple command, something like this
multiline example.
The important thing here is that the HTML output is not included here. That
output will only be included if I run latex2html. This is a very
powerful control mechanism that I use in several areas when creating documents
that need to appear in both PDF and HTML formats.
The commands here are \latex and \html, and the environments are controlled
by the \begin{latexonly}, \end{latexonly}, \begin{htmlonly},
and \end{htmlonly}.
If you're going to be producing HTML documents from your Latex source files,
it's important to know that the HTML package includes many more useful features.
|