[latex2html] Re: [l2h] incorrect equation

John A. Turner John A. Turner" <turner@blueskystudios.com
Fri, 22 Dec 2000 15:34:52 -0500 (EST)


>>>>> "RM" == Ross Moore <ross@ics.mq.edu.au>:

RM> If you use a lot of code within $$....$$,
RM> and several of these in which the only difference lies in the
RM> middle of the code, then it is possible that the algorithm for reusing
RM> images may think that 2 images will be the same, when in fact
RM> they should not be, since the parts which are different have not
RM> contributed to the restricted-length "key" used to identify images.
RM> 
RM> The restriction on the key-length is a function of the database being
RM> used by Perl on the local system. However a different algorithm for
RM> generating keys from the LaTeX code of the image may do a better job.
RM> 
RM> 
RM> There is an alternative approach, using (La)TeX macros.
RM> It involves several steps:
RM> 
RM>  1. Write your math-environment code in a shortened form,
RM>     using home-grown macros with parameters, instead of
RM>     repeating large chunks of code.
RM> 
RM> This is desirable anyway, as it makes for a shorter manuscript.

yes, I already do this extensively

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

sounds good...

RM>  2. Make the macro definitions in a package, and produce a .perl
RM>     module for this package.
RM> 
RM>     Macros defined using  \def  \newcommand  etc.  are expanded;
RM>     but macros defined inside a .perl module are not expanded.
RM> 
RM>     The Perl coding for your macros is easy; since you just have
RM>     to ask LaTeX2HTML to ignore all of them.

[example elided]

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

cool

RM> Please give the above suggestion a try.

works like a charm!

for those who might be curious, using v2k.1beta (please let's move to a
more sane numbering scheme!) didn't change anything

RM> The technique should work, as it is used extensively in other packages
RM> and modules. For example, math.pl has the following:
RM> 
RM> &ignore_commands( <<_IGNORED_CMDS_);
RM> allowbreak
RM> mathord
RM> mathbin
RM> mathrel
RM> mathop
RM> mathopen
RM> mathclose
RM> mathpunct
RM> mathalpha
RM> mathrm
RM> mathbf
RM> mathtt
RM> mathit
RM> mathbb
RM> mathcal
RM> cal
RM> mathsf
RM> smash
RM> _IGNORED_CMDS_
RM> 
RM> all of which are macros that take an argument.

can you briefly tell me what pitfalls there are in doing this more
extensively?  i.e., what sort of macros are suitable for this?  just ones
that are used in eqns?

RM> All the best,
RM> 
RM> 	Merry Christmas,
RM> 
RM> 		Ross Moore

and to you... thanks once again...

-John