# [tex4ht] How to insert HTML code at any location in the generated HTML file?

Wed Jul 10 16:32:06 CEST 2013

On Wed, Jul 10, 2013 at 4:28 PM, Nasser M. Abbasi <nma at 12000.org> wrote:

> On 7/10/2013 5:49 AM, Radhakrishnan CV wrote:
>
>> On Wed, Jul 10, 2013 at 1:54 PM, Nasser M. Abbasi <nma at 12000.org> wrote:
>>
>>  I am converting a latex document that I used to compile with
>>> latex2html to htlatex.
>>>
>>>
>> [...]
>>
>>
>>  What is the correct way to insert HTML code any where in
>>> the document, and have it show at that location in the HTML
>>> file? I have very large amount of HTML code that was inserted in
>>> that document.
>>>
>>>
>> You might use {verbatim} environment as in any LaTeX document.
>>
>> \documentclass{article}
>>
>> \begin{document}
>>
>> \begin{verbatim}
>>
>>     any HTML code here
>>
>> \end{verbatim}
>>
>> \end{document}
>>
>> Hope this helps.
>>
>> Best regards
>>
>>
> Sure, I know I can use Verbatim.
>
> May be I did not explain the problem well.
>
> I want to inject HTML code, into the generated HTML itself
> (when running htlatex only)
>
> If I write
>
> --------------------------
>
> \documentclass{article}
> \begin{document}
>
> \begin{verbatim}
> <h2>This is HTML head 2 </h2>
> \end{verbatim}
>
> \end{document}
> ---------------------------
>
> the HTML generated will just look like this:
>
>    <h2>This is HTML head 2 </h2>
>
> Which is clearly not what I wanted.
>

OK. I misunderstood your problem. I think, this should solve your problem:

\documentclass{article}
\begin{document}

\ScriptEnv{html}
{\NoFonts\hfill\break}
{\EndNoFonts}

\begin{html}
<h2>This is HTML head 2 </h2>
\end{html}

\end{document}

Best regards
--