Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Eliminating Black Rules Under Equation Images

The fifth problem is random underbars and sometimes left-bars on the boundaries of equation images. This only happens if the option `-Ppdf' is passed to dvips for image creation, but that is unfortunately wired in as a default in the standard distribution (at least Red Hat's).

The problem here is due to the relatively new file

/usr/share/texmf/dvips/misc/alt-rule.pro
which defeats LaTex2HTML's algorithm for stripping off these temporary black bars during image processing.

One way to avoid this problem is to eliminate the `-Ppdf' option for dvips in the latex2html configuration file

/usr/share/latex2html/l2hconf.pm
My line reads as follows:
$DVIPSOPT = ''; # -Ppdf pulls in alt-rule.pro which causes black eqn underlines

Another work-around is to modify /usr/share/texmf/dvips/misc/alt-rule.pro to round the dimensions of the marker rules to an integer number of pixels before drawing them (which is how it worked before alt-rule.pro appeared). A copy of alt-rule.pro with the one-line fix installed may be found here. (The line beginning with transform is the added line.)

A true fix (as opposed to the above workarounds) would be to modify LaTex2HTML so that it generates rules having dimensions which are always an integer number of pixels in device coordinates. For example, search for ``\\def\\centerinlinemath'' in the file /usr/bin/latex2html (which generates code into the file images.tex when latex2html is run), and observe the \\vrule code and other rules (the code is easier to read in images.tex). I believe zero-width rules are ok, since that's supposed to map to a width of 1 pixel in print-device coordinates (although nowadays, one pixel can be quite invisible). The problem, if I recall correctly, occurs when the length of the rule is not an integer number of pixels. In that case, alt-rule.pro uses gray-levels to achieve a more accurate image, but then pnmcrop, which is looking for solid black rules, fails to recognize them completely and leaves one or both of them in the image. Another proper fix would be to recognize the gray-edged rules using more robust image detection methods, such as cross-correlation, but that would add a lot of computation. For further discussion, see the mailing list entry on this topic. Another true fix would be to modify the method by which images are forced to be embedded in a rectangle of a certain size by placing black rules on the left and bottom of each image and then trying to crop them off later using pnmcrop. To see all this in action, run with debugging turned on via ``latex2html -d''.


Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download webpub.pdf
[Comment on this page via email]

``Tools for Publishing LaTeX Documents on the Web'', by Julius O. Smith III.
Copyright © 2017-06-24 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA