[l2h] verbatim does not work when having a math equation nearby in a table with '+' in it.

Ross Moore ross.moore at mq.edu.au
Mon Feb 13 02:20:16 CET 2012


Hello Nasser,

On 12/02/2012, at 9:56 AM, Nasser M. Abbasi wrote:

> When I run this:
> 
> -----------------------------------
> \documentclass[12pt]{article}
> \usepackage{html}
> \usepackage{verbatim}
> \begin{document}
> \begin{verbatim}test\end{verbatim}

> \begin{tabular}{|l | }
> $f(x) = x^3 d$\\
> \end{tabular}
> \end{document}
> -------------------------
> 
> It works. Expected output. Verbatim displays 'test' and
> the math fine.

Are you sure this is really all that is happening?

> 
> But I add '+' to the equation above, like this:
> 
> -----------------------------------
> \documentclass[12pt]{article}
> \usepackage{html}
> \usepackage{verbatim}
> \begin{document}
> \begin{verbatim}test\end{verbatim}
> \begin{tabular}{|l | }
> $f(x) = x^3 + d$\\    %added '+'
> \end{tabular}
> \end{document}
> -------------------------
> 
> Then I lose the verbatim! and in addition, the verbatim 'test'
> is replaced by the math as verbatim.

I cannot reproduce your problem.

But just a couple of things that might help.

 1. It is best to do verbatim-like environments as

\begin{verbatim}
test
\end{verbatim}

or  

\verb|test|

As a matter of course it is *always* preferable to put the
  \begin{...}
on a line by itself, and the 
  \end{...}
also on a line by itself.

Although (La)TeX does not require it, it makes good logical sense
to do so in terms of document structure and readability.
Furthermore, there are some environments where LaTeX2HTML *requires* 
the environment delimiters to be on separate lines when the contents 
are to be interpreted as verbatim text, or other special purposes.

So it is a good habit to get into.


 2.  The final \\  in a {tabular} is redundant.
     Even in LateX itself this can cause extra vertical space at the 
     bottom of the table layout. 
     In LateX2HTML, it causes an extra row of blank cells.

> 
> 
> Could someone please explain what I am doing wrong? I'd like to use
> \verbatim but also be able to use math, somewhere else in the document.

Can you run your failing job with  -debug   within a directory 
that can be accessed across the web, and save the console messages
into a file. Make this directory and its siblings listable, and send me 
the URL. I can then try to get an idea of what is going wrong, by 
studying the temporary files that normally get deleted.
 
> 
> Both as compiled using late2html foo.tex
> I am using latex2html 2008, 1.71
> 
> Am I doing something wrong in the above?

Nothing that is obvious to me.

> 
> thanks
> --Nasser


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the latex2html mailing list