[l2h] Making a new environemnt that wraps around rawhtml

Travis Spencer travislspencer at gmail.com
Thu Aug 4 17:50:01 CEST 2005


On 7/29/05, Ross Moore <ross at ics.mq.edu.au> wrote:
> Hi Travis,

Hey Ross.

> You cannot do it that way.
> Nor do you have to ----  make use of  \HTMLcode  instead.
> 
> e.g., use a construction like:
> 
>    \HTMLcode[ID="mystyle"]{DIV}{%
>      ....  whatever ....
>    }
> 
> Parametrise it via:
> 
>   \newcommand{\htmldivID}[2]{\HTMLcode[ID="#1"]{DIV}{#2}}
> 
> then use it with the body of your LaTeX source as:
> 
>   \htmldivID{mystyle}{%
>     ... whatever ...
>   }
> 
> This way you can assign a particular ID to a <DIV>....</DIV> block.

That worked like a charm.  Thanks, Ross.  

I used this suggestion to renew the \maketitle command and wrapped my
document's title in a DIV with a predictable, constant ID; I now have
a very useful hook to apply styles to :-)

With one document down and about 15 to go, I decided it was time for a
custom document class (fancy).  With much hacken and some help from
the nice folks on #latex, I got it working (with LaTeX at least):

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tutorial}[2005/07/30 v.0.1 PSU CS Tutorial class]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass[12pt]{article}
\RequirePackage{html}
\RequirePackage{anysize}

\newcommand{\htmldiv}[2]{\HTMLcode[ID="#1"]{DIV}{#2}}
\let\orig at maketitle\maketitle

\renewcommand{\maketitle}{%
  \htmldiv{docTitle}{
    \orig at maketitle
  }
}

(Isn't that the coolest!? I think so at least, so I had to show it off a bit.)

To my dismay, however, when I compiled my document with l2h, I got a
warning that it couldn't find `tutorial.perl'.  I read about this a
bit in "The LaTeX Web Companion", so I had an idea of what I needed to
do.  I copied `article.perl' to my tutorials working directory and
renamed it `tutorial.perl'.  The warning went away, but the my
`\maketitle' hack still isn't applied.  I think I need a
`do_tutorial_maketitle' or `do_cmd_thetitle' function or something in
my `tutorial.perl' file.  I'm not sure though.

I'll bet the answer is in the manual, and I've just overlooked it.  If
someone could point me in the right direction and help me get unstuck,
I would really appreciate it.

-- 

Regards,

Travis Spencer



More information about the latex2html mailing list