[l2h] alltt bug?

Igor Pechtchanski pechtcha at cs.nyu.edu
Mon Nov 15 21:36:44 CET 2004


Hi, Ross.  Thanks for a quick reply.

On Sat, 13 Nov 2004, Ross Moore wrote:

> Hi Igor,
>
> On 13/11/2004, at 3:58 PM, Igor Pechtchanski wrote:
>
> > Hi,
> >
> > Using the TeX trick of having a command interpret the next character as an
> > argument doesn't work correctly within the alltt environment.  Below is
> > the minimal example.  To reproduce, "latex2html bug.tex".  The <pre> tag
> > will contain "BR>Hello".  I intentionally didn't give any argument to
> > \out, since I wanted to model LaTeX's \@gobblecr.  My system information
>
> This is not a bug in LaTeX2HTML.
> You are trying to use non-obvious markup based upon a TeX-ism,
> that just happens to work for you within a LaTeX document.
>
> You cannot expect LaTeX2HTML to model LaTeX's internals.
> It is not designed that way, and it is not based upon the model established
> by having TeX as the internal engine.

Well, yes, I can't expect it to model LaTeX internals, but it does do
almost the right thing in this particular case.  The snippet of code below
does gobble up the following character -- unfortunately, this nappens
after the newlines were translated to "<br>"s, so the character it gobbles
up is the opening angle bracket.  I suspect that the fix may be as simple
as performing macro substitutions before the alltt environment special
processing (i.e., "\n"=>"<br>" substitutions), but I'm not sure what other
reprecussions of that there may be.

> LaTeX2HTML is designed to give a good, clean translation into HTML of
> the words and commonly-used markup structures of what is described in
> elementary books on LaTeX, and how to *use* it for making well-structured
> documents.
>
> If you want to use TeX-trickiness, then it's all bets off!
> (Try using TeX4ht  instead, and work out how to configure its output
> to give HTML as clean as you'll get with LaTeX2HTML.)

I actually prefer LaTeX2HTML, and the above was only needed for situations
where the line breaks are honored (such as the alltt environment).  I'll
try to explore other ways of fixing this, but please consider the phase
order reversal I suggested above.

> > is in my previous bug report.  Thanks.
>
> Sorry, there'll be no action taken on this.
>
> Either use:
>
>  \out{}
> Hello
>
> if you don't want the `H' treated specially, or use
>
> \out{H}ello
>
> if you *do* want something special to be done.
> No other markup allows an obvious interpretation
> of the intention of this part of your manuscript.

What I want to be treated specially is the *newline* after \out, not the
"H"...  And it would have been, had it not been replaced by "<br>" before
the macro got the chance to work.

> Of course the other approach is to devise the Perl coding
> that does what you want, via a subroutine block
>
>    sub  do_env_myspecialenvironment {
>     ....
>     ....
>    }
>
> for processing the content of markup such as
>
>  \begin{myspecialenvironment}
>  Hello
>  world!
>
>  \end{myspecialenvironment}
>
> or perhaps taking parameters to provide indicators of special
> effects that may be desired:
>
>  \begin{myspecialenvironment}[Hello]
>  world!
>
>  \end{myspecialenvironment}
>
> or
>
>  \begin{myspecialenvironment}[H]
>  Hello
>  world!
>
>  \end{myspecialenvironment}
>
> as appropriate.
>
> Hope this helps,
> 	Ross Moore

Thanks.  As I said, I'll look into this approach as well.
	Igor

> > -------------------- BEGIN bug.tex --------------------
> > \documentclass{article}
> > \usepackage{alltt}
> > \newcommand{\out}[1]{}
> > \begin{document}
> > \begin{alltt}
> > {\out
> > Hello
> > }
> > \end{alltt}
> > \end{document}
> > --------------------- END bug.tex ---------------------

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		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