[l2h] Bug (+ proposed fix): alltt and unquoted command arguments

Igor Pechtchanski pechtcha at cs.nyu.edu
Wed Dec 29 22:03:30 CET 2004


There is some strange interaction between the alltt style file and
unquoted (or, rather, ungrouped) command arguments.  The following
document illustrates the bug:

----------------- BEGIN bug3.tex -----------------
\newcommand{\eatone}[1]{Eating '{#1}'...}
------------------ END bug3.tex ------------------

This produces the following HTML (snipped):

----------------- BEGIN bug3-bad.html -----------------
<META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4">
Eating 'test'...12345

------------------ END bug3-bad.html ------------------

This only occurs if the "alltt" package is loaded and there is a line in
the input file that follows the command and begins with '{'.

The problem seems to be that $next_pair_rx (and $next_pair_pr_rx), used in
the argument processing code, match in multiline mode, and, since they
begin with "^", they will match the start of *any* line, not just the
start of the string representing the rest of the document ($after).

One possible fix for this is to prepend "(?s-m)" to $next_pair_rx and
$next_pair_pr_rx.  This does indeed fix the problem (for me), and produces
the following (correct) HTML (again, snipped):

----------------- BEGIN bug3-good.html -----------------
<META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4">
Eating '1'...2345
------------------ END bug3-good.html ------------------

Please let me know if you need more details, or an actual patch.
      |\      _,,,---,,_		pechtcha at cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

More information about the latex2html mailing list