I use Scientific word (SW), which generates Latex, then I process the Latex output using Latex2html (l2h) to generate HTML as the support for HTML is better with l2h than SW (table of contents, break the page into sub pages, etc...)

SW supports the package hyperref but l2h does not.

\documentclass{article}%
\usepackage{html}
\usepackage{hyperref}%
\begin{document}
\href{http://www.yahoo.com}{yahoo}
\end{document}


The above can't be processed as is by l2h. To process this with l2h this line

\href{http://www.yahoo.com}{yahoo}


needs to change to one that l2h will process, which is

\htmladdnormallink{yahoo}{http://www.yahoo.com}


So I think all what is needed is to make renewcommand or similar (I am not a Latex expert). So that I would write

\documentclass{article}%
\usepackage{html}
\usepackage{hyperref}%

\begin{htmlonly}
\end{htmlonly}

\begin{document}
\href{http://www.yahoo.com}{yahoo}
\end{document}


I do not know if the above makes sense. or possible. without this, I'd have to find a way to parse the latex file each time and change each \href to \htmladdnormallink (may be I can learn sed or such to do it. But if there is a way to do with Latex macro that will be better.

question is: If the above is possible, what will the correct syntax of this command to add at the top ?

FYI

For completion, this is the final setup so that links work both in SW and l2h

 \documentclass{article}%
\usepackage{html}  %    for L2H
\usepackage{hyperref}%  for latex
\begin{document}

\begin{htmlonly}
\end{htmlonly}

\href{http://www.yahoo.com}{yahoo}

\end{document}

-

try the following:

\documentclass{article}%
\usepackage{ifpdf}
\usepackage{html}
\usepackage{hyperref}%

\begin{document}
\ifpdf\else

with \ifpdf\else ... \fi you can define code which is only used when running anything else than pdflatex.
I am missing the point of the answer actually. How is the above going to change \href to \htmladdnormallink everywhere? I do not want to edit the latex file and manually add different code for html vs. latex each time I add a link. I work in SW all the time, and just run l2h to generate HTML. I wanted a way to do this once, at the top, using a macro, which will refdefine all the href to \htmladdnormallink everywhere only when run by l2h. i.e. I needed a switch type logic added in one place only. Thanks. – Nasser Jan 6 '13 at 9:15
Thanks! Yes, that is what I was looking for. Sorry that I did not understand your earlier answer, as I did not see what to write there. btw, l2h does NOT support \ifpdf and \else and all that. But it was easy to just put the \def command inside \begin{htmlonly} and it worked. Thanks again for your help. – Nasser Jan 6 '13 at 9:29
@Nasser: I know that, but that is not important because it should not be used when running pdflatex and used with latex2html which is true. – Herbert Jan 6 '13 at 9:33