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

2013-07-11 Thread Radhakrishnan CV
On Fri, Jul 12, 2013 at 4:23 AM, Karl Berry  wrote:

> Runaway argument?
>
> I see CVR solved your problem with an environment.  That's good (maybe
> we should add that environment in general), but this error indicates the
> problem is simply having a blank line (\par) in the argument, and we
> should just make \HCode \long in order to allow it.  (I admit I didn't
> actually check if something weirder is going on.)
>

Not sure, if making \HCode a \long\def will solve the problem, because,
\HCode gets redefined at several places and within other definitions and
environments.

I think, \ScriptEnv is the best way to inject any kind of source code into
output.

Best
-- 
Radhakrishnan
River 
Valley


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

2013-07-11 Thread Karl Berry
Runaway argument?

I see CVR solved your problem with an environment.  That's good (maybe
we should add that environment in general), but this error indicates the
problem is simply having a blank line (\par) in the argument, and we
should just make \HCode \long in order to allow it.  (I admit I didn't
actually check if something weirder is going on.)

CVR, wdyt?

k


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

2013-07-10 Thread Nasser M. Abbasi

On 7/10/2013 9:32 AM, Radhakrishnan CV wrote:



\documentclass{article}
\begin{document}

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

\begin{html}
This is HTML head 2 
\end{html}

\end{document}



Thank you very much, yes, this is what I wanted. It works now

-

\documentclass{article}
\begin{document}

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

\begin{html}
This is HTML head 2 

test

\end{html}
\fi

\end{document}


regards,
--Nasser



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

2013-07-10 Thread Radhakrishnan CV
On Wed, Jul 10, 2013 at 4:28 PM, Nasser M. Abbasi  wrote:

> On 7/10/2013 5:49 AM, Radhakrishnan CV wrote:
>
>> On Wed, Jul 10, 2013 at 1:54 PM, Nasser M. Abbasi  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}
> This is HTML head 2 
> \end{verbatim}
>
> \end{document}
> ---
>
> the HTML generated will just look like this:
>
>This is HTML head 2 
>
> Which is clearly not what I wanted.
>

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

 Please try this:

\documentclass{article}
\begin{document}

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

\begin{html}
This is HTML head 2 
\end{html}

\end{document}


Best regards
-- 
Radhakrishnan
River 
Valley


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

2013-07-10 Thread Nasser M. Abbasi

On 7/10/2013 6:14 AM, Michal Hoftich wrote:

Correct way is to not insert any HTML code to the document, but
instead redefine ordinary LaTeX commands to insert html codes in .4ht
files.

If you really want to insert HTML code directly, you can define
command which will eat arguments in normally LaTeX run and insert
\HCode with tex4ht. Like this (untested, just an idea):

\documentclass{article}
\ifdefined\HCode
\newcommand\html[1]{%
\HCode{#1}%
}%
\else
\newcommand\html[1]{}%
\fi
\begin{document}
\html{

Thanks. I know the above. But it does not work for large
amount of code, it gives the error I posted.

As I mentioned, this is an old tex file, which contains large
amount of raw HTML code which was processed in latex2html.

I would not do that today, but that is how the tex file is and
I am trying to compile it with htlatex.

Using your example above, if I add just one extra line to
your example HTML code, it fails:

---
\documentclass{article}
\ifdefined\HCode
\newcommand\html[1]{\HCode{#1}}
\else
\newcommand\html[1]{}%
\fi

\begin{document}
\html{world
! Paragraph ended before \HCode was complete.

   \par
l.13 }
  
?

---

The tex file has pages and pages of raw HTML code inserted in
it

\begin{rawhtml}
  
 pages and pages of HTML code


\end{rawhtml}

is it possible to do something like the above in htlatex?

thanks
--Nasser



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

2013-07-10 Thread Michal Hoftich
Correct way is to not insert any HTML code to the document, but
instead redefine ordinary LaTeX commands to insert html codes in .4ht
files.

If you really want to insert HTML code directly, you can define
command which will eat arguments in normally LaTeX run and insert
\HCode with tex4ht. Like this (untested, just an idea):

\documentclass{article}
\ifdefined\HCode
\newcommand\html[1]{%
\HCode{#1}%
}%
\else
\newcommand\html[1]{}%
\fi
\begin{document}
\html{

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

2013-07-10 Thread Nasser M. Abbasi

On 7/10/2013 5:49 AM, Radhakrishnan CV wrote:

On Wed, Jul 10, 2013 at 1:54 PM, Nasser M. Abbasi  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}
This is HTML head 2 
\end{verbatim}

\end{document}
---

the HTML generated will just look like this:

   This is HTML head 2 

Which is clearly not what I wanted.

regards,
--Nasser







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

2013-07-10 Thread Radhakrishnan CV
On Wed, Jul 10, 2013 at 1:54 PM, Nasser M. Abbasi  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
-- 
Radhakrishnan
River 
Valley