Make your own free website on

LaTeX Source for Example.tex

% This document illustrates using LaTeX. LaTeX2HTML and DVIPDFM together
% for graphics and hyperlinks.
% The lines below to use HYPERREF need to be commented out to get numbering to work 
% in the HTML version. Once commented out, run LaTeX several times, and then LaTeX2HTML:
%\usepackage[dvipdfm, latex2html,
%                           colorlinks, linkcolor=blue, urlcolor=blue, citecolor=blue,
%                           bookmarks, bookmarksopen, bookmarksnumbered,
%                           pdfauthor={Charles Clayton}]{hyperref}
% The command below simplifies the process of including an image. It assumes that the images
% are in a sub-folder called "graphics" in the folder that the .tex document lives in.
% It also assumes a bounding box file created e.g. with EBB exists in the subdirectory.
% If the graphic is (for example) called graph.jpg, then the bounding box file should be
% The first parameter is the name of the image, the second the text for the ALT tag.
% Note that for some reason it goes wrong if you use \begin{htmlonly}...\end{htmlonly}
% instead of \html. This "feature" might however change in subsequent versions.
% The next two commands are just modified versions of \img
% The first shows how to put a box round things in both the HTML and PDF versions
% The seconds shows how to scale the image.
\html{\htmladdimg[ALT="#2" BORDER="1"]{../graphics/#1}}}
\html{\htmladdimg[ALT="#2" WIDTH="5cm"]{../graphics/#1}}}
\title{Example Document}
\author{Charles Clayton}


This document includes graphics and hyperlinks and should run correctly through 
both LaTeX2HTML and DVIPDFM. See the document 
\htmladdnormallink{Getting \LaTeX\ and \LaTeX2HTML\ and DVIPDFM to Work Together}
{} for more information.}


These links should `work' (i.e. be clickable) in both the PDF and HTML documents.
\item A link to an external web page: \htmladdnormallink{}{}
\item A link to the \htmlref{next section}{sec:Gr}
\item A link to the next section, using a standard \verb+\ref+: Section \ref{sec:Gr}. 
To get section numbers you must use the \verb+show_section_numbers+ command line 
option with \LaTeX2HTML. Also, the line that uses the \verb+hyperref+ package must 
be commented out (due to a bug) and LaTeX re-run several times before running \LaTeX2HTML.
\item It does not seem possible to get a single link to e.g. `Section 2', as 
\verb+\ref+ does not work within \verb+\htmlref+ and similar commands. 
One can get nearly there by combining an \verb+\htmlref+ 
and a \verb+\ref+: \htmlref{Section}{sec:Gr} \ref{sec:Gr}.
\item This is an ordinary \verb+\cite+: \cite{ref1}. Note that \verb+\htmlcite+ does not
 seem to work in the PDF version (unlike \verb+\htmlref+ which works in both)
\item This is a reference to equation \ref{eqn1}
\item This is a reference to the \htmlref{same equation}{eqn1} done with \verb+\htmlref+

The figures in this document demonstrate including a JPEG image in both the PDF and HTML
versions. For details of how to use EPS graphics, see the document
\htmladdnormallink{Getting \LaTeX\ and \LaTeX2HTML\ and DVIPDFM to Work Together}
{}. Notice that
\item the ALT tag is set in the HTML versions;
\item if the \verb+\caption+ comes before the \verb+\includegraphics+, 
the caption will be above the image, otherwise it will be below the image. 
This is only the case in the PDF document, however.

\img{graphic.jpg}{A graph of some statistical distributions}
\caption{A graphic}

\boxedimg{graphic.jpg}{A boxed graph}
\caption{A boxed graphic}

\caption{A scaled graphic. In the PDF version, the caption will be on top of the image}
\scaledimg{graphic.jpg}{A scaled graph}

\section{Other Remarks}
\item Note that the PDF version has working bookmarks;
\item The author field is also set in the PDF document information;
\item Note the use of a ALT tag in the equation below. 
This provides meaningful alternative text if the equation is not displayed or a tool tip
\htmlimage{ALT="A fundamental equation"}

\bibitem{ref1} A test bibliography entry.


Home Up

Charles Clayton 2000. Please use this information at your own risk.



Hit Counter