I am trying to compile this example with pdflatex and also with latex2html.
I need to make the table column specification different for each case.
Here is an example of what I have, but this generates an error, and I am not sure how to resolve the error. What is wrong with this?
\documentclass[]{article}%
\usepackage{html}
\begin{document}
\begin{htmlonly}%
\begin{tabular}{|p{.5in}|}
\end{htmlonly}%
\begin{latexonly}%
\begin{tabular}{|c|}
\end{latexonly}%
\hline
test1\\
test2\\
\end{tabular}
\end{document}
then
pdflatex foo.tex
gives
LaTeX Error: \begin{tabular} on input line 10 ended by \end{latexonly}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \end{latexonly}
%
Why it thinks tabular ended with latexonly?
I really do not want to make 2 copies of the whole table itself, and write
\begin{latexonly}.. table ...\end{latexonly}
\begin{htmlonly}.. table ...\end{htmlonly}
I thought I'll try to be 'smart' and just put these around the column specs, but I think I do not understand how Latex environments interact with each others very well.
Unless I am making some silly error, is there a better way to do this (Other than duplicating the whole table)?
thanks, ps. tags here are confusing, which tag should one use for general latex questions? Is this the right group for Latex questions or is the other stackoverflow group the right one?
update I got a solution from another group that works for me, thought to update here.
The solution is to use \latexhtml like this
\latexhtml{% latex version
\begin{tabular}{|c|}%
}{% version for latex2html
\begin{tabular}{|p{.5in}|}%
}
thanks to Robin Fairbairns for the above solution. This worked for my latex2html and pdflatex.
thanks also to everyone here for taking the time to answer. So many things to learn about Latex.