[l2h] problems with renewenvironment

Gregor Goldbach 7goldbac@informatik.uni-hamburg.de
Tue, 22 Jan 2002 12:12:26 +0100


On Sat, Jan 19, 2002 at 10:13:19AM +1100, Ross Moore wrote:

> > I have interesting problems when redefining environments. latex2html
> > won't convert the following small document:
> > 
> > --- 8< ---
> > 
> > \documentclass{article}
> > \usepackage{graphicx}
> > 
> > \newcommand{\cmda}[1]{bla #1}
> > \newcommand{\cmdb}[1]{\emph{#1}}
> > \newenvironment{enva}{\renewcommand{\cmda}{\cmdb}}{}
> > 
> > \begin{document}
> > 
> > \begin{enva}
> > asdf \cmdb{asdf}
> > \end{enva}
> > 
> > asfdf
> > \includegraphics[]{test.eps}
> > asdf
> > 
> > \end{document}
> 
> Yes. LaTeX2HTML's expansion model is different to that of TeX,
> so the environment definition:
> 
>  \newenvironment{enva}{\renewcommand{\cmda}{\cmdb}}{}
> 
> does not work.
> 
> There are actually 2 problems.
> 
> The first is semantics only;
> you should use a syntax of:
> 
> \newenvironment{enva}{\renewcommand{\cmda}[1]{\cmdb{##1}}}{}

Thanks. The real world part where I need this follows:

--- 8< ---

\newlength{\Mylen}
\newlength{\Mylabelwidth}

\newcommand{\entrylabel}[1]{%
  \setlength{\Mylabelwidth}{20mm}%
  \settowidth{\Mylen}{\textbf{#1}}%
  \ifthenelse{\lengthtest{\Mylen > \Mylabelwidth}}%
      {\parbox[b]{\Mylabelwidth}%
          {\makebox[0pt][l]{\textbf{#1}}\\}}%
      {\textbf{#1}}%
  \hfil\relax}

\newenvironment{entry}
  {\begin{list}{}%
      {\renewcommand{\makelabel}[1]{\entrylabel{##1}}%
        \setlength{\labelwidth}{20mm}%
        \setlength{\leftmargin}{\labelwidth}%
        \addtolength{\leftmargin}{\labelsep}%
      }%
  }%
{\end{list}}

--- 8< ---

This works fine now ;)

> The change in syntax suggested above cures this problem.
> However, the redefinition of \cmda  never happens. 

I understand that in my example code above \makelabel is redefined in
LaTeX but not in HTML. Is this correct?

> > Thanks for your help,
> 
> Hope this helps,

Yupp.

  Gregor