[tex4ht] How to use \newcommand to pass argument #n to tex4ht via direct HTML environment?

Nasser M. Abbasi nma at 12000.org
Wed Aug 13 07:57:39 CEST 2014

I am trying to make a newcommand to generate some
repetitive HTML code that I generate in latex using
the \ScriptEnv{html}...\begin{html}...\end{html}

I have to use pure HTML code fragments since the code
I want to generate can't be build in latex. For
illustration, I show a simple example below using
href= for now. (which ofcourse can be done in Latex using
\href{} but this is an example. The actual HTML I want
to generate uses <video> tag, but similar concept.

First, the example I am trying to compile:

      <a href="#2/index.htm"> mylink </a>  %-->problem here
\mySection{Wave equation}{folderA}

When I type htlatex pass_string.tex, I get error

Runaway argument?
  <a href="folderA/index.htm"> mylink </a> \end {html} ^^M^^M\end{docu\ETC.
! File ended while scanning use of \:temp.
<inserted text>
<*> ...tother\HCode .a.b.c.\input  pass_string.tex

How do I pass the second argument #2 to HTML as shown
above? Why is the error coming from html4-math ? There is
no math at all in the above?

The equivalent latex code works with no problem:

\href{#2/index.htm}{my link}
\mySection{Wave equation}{folderA}

It seems there needs a way to pass #1,#2.. to HTML
different from the direct way done above. But how?

thank you,

More information about the tex4ht mailing list