[l2h] Making a new environemnt that wraps around rawhtml

Travis Spencer travislspencer at gmail.com
Fri Jul 29 21:56:45 CEST 2005


Hey All,

In my quest to associate unique IDs with arbitrary sections of my
LaTeX documents, I think I may have found a solution that will work. 
I read about the `rawhtml' environment, and, with it, I can wrap any
LaTeX command, environment, etc. in a DIV with a specific ID.  Then I
can style that DIV using a CSS ID selector.  Here is an example:

\begin{rawhtml}
<div id="docTitle">
\end{rawhtml}
\maketitle
\begin{rawhtml}
</div>
\end{rawhtml}

This produces the HTML `<div id="docTitle">...</div>' witch I can
style using a selector such as `DIV#docTitle'.  This is helpful but
that's a lot of typing.  So, I read about how to create a new, custom
environment in hopes of distilling the above example down do something
like this:

\begin{htmldiv}{docTitle}
\maketitle
\end{htmldiv}

To that end, I hacked up this new environment:

\newenvironment{htmldiv}[1]
               {\begin{rawhtml}<div id="#1">\end{rawhtml}}
               {\begin{rawhtml}</div>\end{rawhtml}
}

The problem with this is that the nested rawhtml environment doesn't
set the id attribute's value to that of the enclosing environment's
first argument but rather to a literal `#1'.

Does anyone more experienced with LaTeX know a way to pass this value
into the rawhtml environment?

TIA.

-- 

Regards,

Travis Spencer



More information about the latex2html mailing list