[l2h] Re: LaTeX2HTML \verb / \verb* problem

Ross Moore ross@ics.mq.edu.au
Sat, 2 Mar 2002 09:31:01 +1100 (EST)

>     I posted this to the mailing list but got no response.  It seems
> that LaTeX2HTML does not bother to distinguish between \verb and \verb*.

It does now.
Get the latest revision (1.62) of latex2html.pin  from  www.latex2html.org

Here are the diffs if you want to patch a version that is installed already.
(Beware, the line-numbers will be different in an installed version.
It is sufficient to search for instances of $verb_mark and apply the simple
edits recorded in the following diffs.)

landau.ics.mq.edu.au> cvs diff -r1.61 -r 1.62 latex2html.pin
Index: latex2html.pin
RCS file: /home/latex2ht/cvs/latex2html/user/latex2html.pin,v
retrieving revision 1.61
retrieving revision 1.62
diff -r1.61 -r1.62
< # $Id: latex2html.pin,v 1.61 2001/12/08 06:46:47 RRM Exp $
> # $Id: latex2html.pin,v 1.62 2002/03/01 22:13:32 RRM Exp $
< my ($REVISION) = q$Revision: 1.61 $ =~ /:\s*(\S+)/;
> my ($REVISION) = q$Revision: 1.62 $ =~ /:\s*(\S+)/;
>     my $vbmark = $verb_mark;
>       #RRM: retain knowledge of whether \verb* or \verb
>       $vb_mark = ($1 =~/^\s*\*/? $verbstar_mark : $verb_mark);
<       # statement with $verb_mark
>       # statement with $verb_mark or $verbstar_mark
<               join('',$verb_mark,$id,$verb_mark)
>               join('',$vb_mark,$id,$verb_mark)
<     else {&replace_verb_marks if /$verb_mark/;}
>     else {&replace_verb_marks if /$verb_mark|$verbstar_mark/;}
<     s/$verb_mark(\d+)$verb_mark/
>     s/(?:$verb_mark|$verbstar_mark)(\d+)$verb_mark/
<     s/$verb_mark(\d+)$verb_mark//go;
>     s/($verb_mark|$verbstar_mark)(\d+)$verb_mark//go;
<     s/$verb_mark(\d+)$verb_mark/\\verb*$verb_delim{$1}$verb{$1}$verb_delim{$1}/go;
>     s/$verbstar_mark(\d+)$verb_mark/\\verb*$verb_delim{$1}$verb{$1}$verb_delim{$1}/go;
>     s/$verb_mark(\d+)$verb_mark/\\verb$verb_delim{$1}$verb{$1}$verb_delim{$1}/go;
<       if ($pre_bit =~ /$verb_mark$/) {
>       if ($pre_bit =~ /($verb_mark|$verbstar_mark)$/) {
>     $verbstar_mark = '<tex2html_verbstar_mark>';

> It performs some sort of internal translation and does not remember
> whether inline verbatim text was associated with a \verb or with a
> \verb*.  When translated back for rendering by latex, it is
> unconditionally translated to the \verb* form, thus marking spaces.

Now images generated from LaTeX code containing \verb or \verb*
give the correct results.

There is no attempt made by LaTeX2HTML to alter spaces in the verbatim
strings on HTML pages, when \verb* was used;
 e.g. turn each space into an _ character.

Now it is a simple matter to include coding for this.
Does anyone think it is a desirable feature to have ?
My own view is "probably; it could perhaps be useful for documentation"
but I'll wait to hear of any objections (or stronger support) before
making such a change.

>     Now, it's easy enough to edit the code so that \verb is used instead 
> of \verb*, but the real problem is the lack of choice -- I either must
> always have unmarked spaces, or I must always have marked spaces, and
> neither option is good for me.  How difficult would it be to fix this?

Not hard at all, as it turned out.

Hope this helps,

	Ross Moore

> Logan
> -- 
> y(c){return putchar(c);}main(){y(y(y(17+y(y(55+y(y(y(54+y(y(13+
> y(y(y(3+y(48+y(28+y(y(y(8+y(y(13+y(25+y(40+y(y(13+y(y(y(35+y(76
> ))-8)-6))-78))))-3))-83)))))-8)-6))-46))-2)-70))-1))-55)-52);};