[l2h] Black bars under integral signs when thelimitsof integration are -\infty and +\infty or analgebraicfraction for each of the upper and lower limits

Ross Moore ross.moore at mq.edu.au
Fri Apr 15 08:24:15 CEST 2011

Hello Pat,

On 15/04/2011, at 2:42 PM, Pat Somerville wrote:

> In GIMP I could see that the right-hand portion of the upper limit of positive infinity was either right at the right-hand edge of the dash-lined box surrounding the image or perhaps was cut off there; I'm not sure.  

> Can you or someone explain to me the mechanisms in detail that cause the unwanted black line segments to be generated?  So far I know from you, Dr. Takeno, that if a mathematical expression inside an image would otherwise extend beyond the right border of the image, somehow the black line segment was generated underneath the image.  You explained something about the first step of the cropping procedure which was involved.

The problem that needs to be solved is to align images inline, 
so that they appear to sit nicely on the baseline when viewed 
in a web-browser.

However, HTML only allows vertical alignments of:
  "top", "bottom" and "middle".

Thus it is "middle" alignment which must be used.
But to do this, there often needs to be sufficiently much
white-space below the baseline, to balance what is above it.
That is, the baseline has to be seen to be exactly in the
middle of the image.

The image is typeset on a smallish page, but not all of this
is actually needed, so first some excess white-space must be
cropped away. But you cannot crop all of it, else the middle
alignment will not do what is required.

Hence part of the image needs to be (at least part of) a frame,
that encompasses the full height, depth and width that is required.
This is the "black bars" that you see, when a step in the process
does not work as intended.

The TeX coding in  images.tex  is designed to produce those black
bars at exactly the right place so that they enclose neatly the
full image plus the correct amount of white-space padding so that
the final image will align appropriately, after:

  1.  crop away excess whitespace
  2.  crop away the "black bar" at the bottom
  3.  crop away the "black bar" at the left side

However, because colours can be used, both for the image content
and the background, and different scale factors can be chosen,
achieving the correct amount of cropping is not as easy as you
might think it should be.

It is done by cropping away whole rows and columns that are all
of the same colour.

Normally it will be "white" for step 1., leaving behind a rectangle 
including the "black bars" --- "cropping bars" is a better term.

Then for steps 2. & 3. the bottom and left-side cropping bars
are removed "provided" the whole row (or column) is indeed all
of the same colour --- usually black. 

Mostly this works pretty well, but it relies on the assumption
that the cropping bars do indeed enclose the full contents
that are to be shown. It is when this assumption is not actually
true that the black bars will remain.

Your example failed presumably because the width when TeX typesets
an \hbox  containing  \int_{-\infty}^{\infty}  has one of the
limits actually protruding outside the final box dimensions, by more
than the extra tolerance that LaTeX2HTML allows for the lengths
of the cropping bars.

> I just guess from what you wrote, Dr. Takeno, that the script eqnfix.sh obtained from http://www.vyvy.org/main/en/node/102 on the Internet  might not have been able to eliminate the black line segment under my integral sign due to a piece of the upper limit that otherwise would have extended beyond the right border of the .png image.

Yes. Adding that extra \hspace{...} presumably expands the width
of the typeset \hbox (described above).

You should be able to do it also using a TeX \phantom  :
     $\int_{-\infty}^{\infty} \phantom{dx}$

But this might be too wide, so just adding a bit of extra space
would probably do:

Similarly forcing extra space, either vertically or horizontally,
can be the best solution in other circumstances too;
 e.g. when using fancy fonts with twirls and swashes, such as
with Zapf Chancery, or calligraphic styles.

> Thanks, Professor Ross Moore, for suggesting I use the -debug option in a latex2html command.  

While LaTeX2HTML is quite good for producing websites based on LaTeX
content --- I spent many man-hours working on it, along with others,
back in the 1990s and early this century --- it is now rather dated.

The software that you should be looking at for 21st century websites
is called MathJAX. 

By Googling around, you should be able to find lots of articles
that decry the use of images of bit of mathematics. 
It is better to get the browser to do proper TeX-based typesetting 
using JavaScript, or other sophisticated scripting language.
However not all web browser software can support this.  :-(

This has always been the case, since the mid-1990s.
MathJAX is the best supported solution so far.

Hope this helps,


Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the latex2html mailing list