[latex2html] Re: [l2h] incorrect equation

Ross Moore ross@ics.mq.edu.au
Fri, 29 Dec 2000 10:50:20 +1100 (EST)

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

> RM> # these macros are only ever used within math-environments
> RM> # and made into images;
> RM> # so just ignore them for all other processing
> RM> 
> RM> &ignore_commands( <<_IGNORED_CMDS_);
> RM> mathmacroA
> RM> mathmacroB
> RM> mathmacroC
> RM> ....
> RM> ...
> RM> mathmacroZ
> RM> 
> RM> 1;
> RM> 
> RM> %%%% end of homegrown_macros.perl %%%%%%%%
> RM> 
> 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.
> OK, as you and I both found, this solves the problems with the incorrect
> equation images.
> However, I noticed a problem - if a macro cmd appears within the text

Within $..$s, or just straight in the text ?

> rather than in a displaymath or equation environment, the math doesn't
> appear.

The above solution works because LaTeX2HTML parses math differently
to the way it parses text. 
If a math-environment contains control-sequences apart from a few
that are rather trivial in TeX, then an image is made of the whole
environment or cell in an alignment.

(Actually, there are several expansion models for math; this solution
is best when you want largish images with little math-parsing.)

In text, the effect of the declaration using:
is to simply ignore the commands, as the name suggests.
You will get nothing at all, and any arguments will simply
remain in the text, unless the shape of the arguments has been
specified also (see below).

There are 4 other types of declaration:
(e.g. from  latex2html.pin)

&process_commands_in_tex (<<_RAW_ARG_CMDS_);
&process_commands_inline_in_tex (<<_RAW_ARG_CMDS_);
&process_commands_nowrap_in_tex (<<_RAW_ARG_NOWRAP_CMDS_);
&process_commands_wrap_deferred (<<_RAW_ARG_DEFERRED_CMDS_);

The first 2 of these both cause an image to be made,
if the command is encountered during parsing;
i.e. in text, or in the advanced modes of math-parsing.

The first uses math-mode in TeX, when making the image;
the 2nd does not use math-mode.

The 3rd is for commands that should go into the images.tex file,
but which do not cause any visible output;
e.g. \setcounter{equation}{<num>}

The 4th encloses a command and its arguments inside a set
of braces {...} but does not (of itself) cause an image.
This is needed with some commands, to get the expansion
occurring in correct sequence during LaTeX2HTML processing.

In all 5 of these "declaration" methods, the shape of the 
arguments can be specified:

&process_commands_inline_in_tex (<<_RAW_ARG_CMDS_);
framebox # [] # [] # {}

says that \framebox can take 2 optional arguments (the []s)
and one required argument (the {}s), in that order.

Other patterns can be specified for the arguments;
you can see examples in the latex2html.pin and other
Perl modules.

> Examples are always best, so look here:
>   http://john.turner.org/l2h/2k.1beta/ignore_cmd/
> So my question is, is this intended behavior (i.e. misunderstanding on my
> part) or a bug?

In your previous email you said that these were being used
within larger math-environments; my answer was based upon that.

It was not a full description of all the possibilities.
Christmas intervened, and a trip to California (where I am 
now for 3 more weeks), before I could give you more details.

Hopefully this email gives you enough for now;
write again if there are further difficulties.

All the best in the festive season,


> thx...
> -- 
> 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