According to Ben Armstrong:
> I didn't see this topic covered in the FAQ.  Does latex2html handle
> parameters to \def?
> 
> For example, supposing we have a file, simple.tex, that contains:
> 
>       \def\foo#1{foo#1}
>       \documentstyle{article}
>       \begin{document}
>       \foo{bar}
>       \end{document}
> 
> What I'm getting as output is:
> 
>       foo#1bar
> 
> not:
> 
>       foobar
> 
> as I would have expected.  Our documentation is full of custom-made
> macros of this sort.  How do I need to modify these macros to make
> them work with latex2html?

Hi,

1.The docs do warn against using \def (a TeX-ism). LaTeX2HTML is
  a LaTeX translator (though it will translate most plain TeX
  stuff).

  So you should use

    \newcommand{\foo}[1]{foo#1}

  or

    \renewcommand{\foo}[1]{foo#1}

  I get problems with using \def when the command already
  exists and is being redefined (using \renewcommand invariably
  makes the problems go away). Also, LaTeX2HTML can't translate
  complicated \def templates. You should be able to convert
  most of your \def s to \newcommand s with a few global
  substitute commands using an editor like vi or emacs.

2.Why are you using \documentstyle? ... haven't you updated to
  LaTeX2e yet? If you can use \documentclass ... then you will
  find that latex (if you have updated) will run without going
  into LaTeX2.09 compatibility mode ... and I believe there are
  significant differences with how LaTeX2HTML behaves.

3.The right place for definitions/macros is in the *preamble*
  of the LaTeX document, i.e. *after* \documentclass and 
  \usepackage commands and *before* \begin{document}.
  Why? ... consider what happens if the documentclass or
  packages you use define some of the macros/definitions
  you put before the \documentclass line. Also, 
  LaTeX2HTML may expect macros to be in the preamble??
  Ross will have to clarify that.

In conclusion ... try something like:

  \documentclass{article}
  % \usepackage{amsmath}    % Example of how to input a .sty file
  \newcommand{\foo}[1]{foo#1}
  \begin{document}
  \foo{bar}
  \end{document}

  Regards,
  Greg Gamble
___________________________________________________________________
Greg Gamble   __________________      mailto:[EMAIL PROTECTED]
Department of Mathematics ___                 Tel: +61-8 9380 3383
The University of Western Australia           Fax: +61-8 9380 1028
NEDLANDS WA 6907  AUSTRALIA         http://maths.uwa.edu.au/~gregg/
___________________________________________________________________

Reply via email to