[latex2html] Re: [l2h] incorrect equation

Ross Moore Ross Moore <ross@ics.mq.edu.au>
Fri, 22 Dec 2000 18:57:40 +1100 (EST)

> >>>>> "MW" == Martin Wolf <martin@familiewolf.de>:
> MW> Hallo John!
> MW> I'm guessing that you are running l2h under a Win*-operating-system.
> nope - I'm on SGI Irix 6.5.6m
> MW> Then the problem is a little l2h-bug:
> MW> 
> MW> in the function &find_unique(pstoimg) two image-files are opened and
> MW> compared. To work correct, the files must be set to the binary mode by
> MW> calling binmode(filename); after the open(...) command. That solved the
> MW> problem for me.
> well, as you might imagine, that doesn't have an effect for me - but I do
> think the problem may be in how two images are found to be identical

Yes, that is possible.
Someone had such problems once before.

If you use a lot of code within $$....$$,
and several of these in which the only difference lies in the
middle of the code, then it is possible that the algorithm for reusing
images may think that 2 images will be the same, when in fact
they should not be, since the parts which are different have not
contributed to the restricted-length "key" used to identify images.

The restriction on the key-length is a function of the database being
used by Perl on the local system. However a different algorithm for
generating keys from the LaTeX code of the image may do a better job.

There is an alternative approach, using (La)TeX macros.
It involves several steps:

 1. Write your math-environment code in a shortened form,
    using home-grown macros with parameters, instead of
    repeating large chunks of code.

This is desirable anyway, as it makes for a shorter manuscript.

Now you need a way to stop LaTeX2HTML from expanding the macros
early in the processing. Since they are destined to be used for
images anyway, there is absolutely no need for LaTeX2HTML to do
this expansion. Thus there will be a performance saving as well.

 2. Make the macro definitions in a package, and produce a .perl
    module for this package.

    Macros defined using  \def  \newcommand  etc.  are expanded;
    but macros defined inside a .perl module are not expanded.

    The Perl coding for your macros is easy; since you just have
    to ask LaTeX2HTML to ignore all of them.

%%%% homegrown_macros.perl %%%%%%%%

# these macros are only ever used within math-environments
# and made into images;
# so just ignore them for all other processing

&ignore_commands( <<_IGNORED_CMDS_);


%%%% end of homegrown_macros.perl %%%%%%%%

   Note that it isn't even necessary to encode the argument structure
   of these macros as the whole (unexpanded) code block will just
   be passed into images.tex, when it comes time to prepare the images.

> thanks for taking a look...

Please give the above suggestion a try.

The technique should work, as it is used extensively in other packages
and modules. For example, math.pl has the following:

&ignore_commands( <<_IGNORED_CMDS_);

all of which are macros that take an argument.

All the best,

	Merry Christmas,

		Ross Moore

> -- 
> John A. Turner, Ph.D.           Senior Research Associate
> Blue Sky Studios, 44 S. Broadway, White Plains, NY  10601
> http://www.blueskystudios.com/             (914) 259-6319