next up previous contents index
Next: Figures and Image Conversion Up: No Title Previous: Multi-lingual documents, using Images

  
Mathematics

There are various different ways in which LATEX2HTML can handle mathematical expressions and formulas: Which is the most appropriate normally depends on the context, or importance of the mathematics within the entire document. What LATEX2HTML will produce depends upon
1.
the version of HTML requested;
2.
whether or not the special `math' has been loaded;
3.
whether the -no_math command-line option has been specified, or (equivalently) the $NO_SIMPLE_MATH variable has been set in an initialisation file.
The strategies used to translate math expressions are summarised in the table below for HTML 3.0+ and the subsequent table for HTML 2.0.


 
Table: Mathematics translation strategies, for HTML versions 3.0 and 3.2,
using <SUP> and <SUB> tags and <TABLE>s
`math' switch strategy adopted 
not loaded -- textual representation where possible,
else image of whole expressions
not loaded -no_math always generates an image of the whole
expression/environment
loaded -- uses entities and <MATH> tags; e.g. for HTML-Math (or MathML in future)
loaded -no_math textual representation where possible, with images of sub-expressions
 

Using the -no_math switch is best for having a consistent style used for all mathematical expressions, whether inline or in displays. The images are of especially good quality when ``anti-aliasing'' is being used (see here), provided the browser is set to have a light background colour. (When set against a gray or dark background, these images can become rather faint and hard to read.)

The final strategy above, using -no_math is the preferred method for good quality mathematics with HTML version 3.2 . It combines the browser's built-in fonts with the best quality images, when needed. To obtain it use the command-line option switches:

-no_math -html_version 3.2,math
This is what was used when creating this manual. For a more detailed discussion of processing mathematics using this strategy see the online document by the present author, entitled ``Mathematics with LATEX2HTML''. Examples below show how to generate an image of a whole environment, even with these options in force.


Since the HTML 2.0 standard does not include superscripts and subscripts, via the <SUP> and <SUB> tags, the options are more limited. In this case creating images of sub-expressions is not so attractive, since virtually the whole expression would consist of images in all but the simplest of cases.


 
Table: Mathematics translation strategies, for HTML version 2.0
`math' switch strategy adopted 
not loaded -- textual representation where possible,
else image of whole expressions
not loaded -no_math always generates an image of
the whole expression or environment
loaded -- entities and <MATH> tags for HTML-Math
loaded -no_math always generates an image of the whole
expression or environment




    

Here are some examples of mathematical expressions and environments processed by LATEX2HTML using different strategies. They are automatically numbered ...

 
$\displaystyle \Phi_{l+1,m,n}^{}$ = $\displaystyle \Bigl($$\displaystyle \Phi$ + h$\displaystyle {\frac{\partial\Phi}{\partial x}}$ + $\displaystyle {\textstyle\frac{1}{2}}$h2$\displaystyle {\frac{\partial^2\Phi}{\partial x^2}}$ + $\displaystyle {\textstyle\frac{1}{6}}$h3$\displaystyle {\frac{\partial^3\Phi}{\partial x^3}}$ +  ... $\displaystyle \Bigr)_{l,m,n}^{}$ (1)

... with some gratuitously ácçënted text in-between ...    
$\displaystyle {\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}}}$ + $\displaystyle {\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}}}$      
+ $\displaystyle {\frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}}}$ = - Il, m, n(v)  .     (2)

The latter example uses an eqnarray environment and the \nonumber command to suppress the equation number on the upper line.


Notice how simple alphabetic characters that are not part of fractions appear in the (italiced) text-font selected using the browser's controls. This may appear slightly different from the same symbol being used within a fraction, or other mathematical construction requiring an image to be generated. This is most apparent with the letter `h' in the first equation and the subscripts at the end of the second equation.

 

By inserting an \htmlimage{} command into a math, equation or displaymath environment, a single image will be created for the whole environment. For an eqnarray environment, this will lead to having a single separate image for each of the aligned portions. The argument to \htmlimage need not be empty, but may contain information which is used to affect characteristics of the resulting image. An example of how this is used is given below, and a fuller discussion of the allowable options is given in the next section.

 

  
Scale-factors for Mathematics.

When an image is to be made of a mathematical formula or expression, it is generally made at a larger size than is normally required on a printed page. This is to compensate for the reduced resolution of a computer screen compared with laser-print. The amount of this scaling is given by the value of a configuration variable $MATH_SCALE_FACTOR, by default set to 1.6 in latex2html.config.
change_begin97.1
A further variable $DISP_SCALE_FACTOR is used with `displayed math' equations and formulas. This value multiplies the $MATH_SCALE_FACTOR to give the actual scaling to be used. The main purpose of this extra scaling is to allow some clarity in super/subscripts etc.
change_end 97.1

 

  
Anti-aliased Images.

Here are the same equations as previously, this time as images of the complete contents of the equation environment, and complete aligned parts of rows in an eqnarray. For a comparison, the second group of images use anti-aliasing effects, whereas the first image does not; a 600dpi printing is probably necessary to appreciate the difference in quality. Compare these images with those in a later section.
  
Figure: Images of equation displays, at normal screen resolution
\begin{displaymath}\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} ...
...\frac{\partial^3\Phi}{\partial x^3} + \,\ldots\,\Bigr)_{l,m,n}
\end{displaymath} (3)
$\displaystyle \frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}}$      
$\displaystyle + \frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}} = -I_{l,m,n}(v)\;.$     (4)


These images of the whole environment were created using the \htmlimage command, to suppress the extended parsing that usually occurs when the `math' extension is loaded; viz.

\begin{equation}
\htmlimage{no_antialias}
\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
...
\end{equation}
%
\begin{eqnarray}
\htmlimage{}
\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
...
\end{eqnarray}
Further aspects of the options available when generating images are discussed in the next section, in particular with regard to the quality of printed images.

 

The \mbox command.


change_begin97.1
Another way to force an image to be created of a mathematical expression, when global settings are not such as to do this anyway, is via the \mbox command having math delimiters within its argument.

Normally \mbox is used to set a piece of ordinary text within a mathematics environment. It is not usual to have math delimiters $...$ or \(...\) within the argument of an \mbox. Whereas earlier versions of LATEX2HTML simply ignored the \mbox command (treating its argument as normal text), the presence of such delimiters now results in an image being generated of the entire contents of the \mbox. It is not necessary for there to be any actual mathematics inside the \mbox's contents;
e.g. \mbox{...some text...${}$} will cause an image to be created of the given text.
change_end 97.1

 

The \parbox command.


change_begin97.1
The \parbox[ <align>]{ <width>}{ <text>} command also generates an image of its contents, except when used within a tabular environment, or other similar table-making environment. Here the important aspect is the width specified for the given piece of text, and any special line-breaks or alignments that this may imply. Hence to get the best effect, LATEX is used to typeset the complete \parbox, with its specified width, alignment and contents, resulting in an image.
change_end 97.1

        

The heqn package.


change_begin96.1
If you need HTML 2.0 compatible Web pages, and have a document with a great many displayed equations, then you might try using the heqn package. Inclusion of the heqn.sty file has absolutely no effect on the printed version of the article, but it does change the way in which LATEX2HTML translates displayed equations and equation arrays. It causes the equation numbers of the equation environment to be moved outside of the images themselves, so that they become order-independent and hence recyclable. Images that result from the eqnarray environment are also recyclable, so long as their equation numbers remain unchanged from the previous run.

     
The \nonumber command is recognised in each line of the equation array, to suppress the equation number. A side-effect of this approach is that equation numbers will appear on the left side of the page. The heqn package requires the html package.
change_end 96.1

Using HTML Version 3.2 the heqn package is quite redundant, since equation numbers are placed in a separate <TABLE> cell to the mathematical expressions themselves. It is not required and should not be requested, since this will override some of the improved functionality already available.



 
next up previous contents index
Next: Figures and Image Conversion Up: No Title Previous: Multi-lingual documents, using Images
root
1998-02-23