Re: [tex4ht] How to insert HTML code at any location in the generated HTML file?
On Fri, Jul 12, 2013 at 4:23 AM, Karl Berry k...@freefriends.org 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 Valleyhttps://maps.google.com/maps?q=River%20Valley,%20Thiruvananthapuram%20Neyyardam%20Road,%20Kerala,%20Indiavector=1
Re: [tex4ht] How to insert HTML code at any location in the generated HTML file?
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
[tex4ht] How to insert HTML code at any location in the generated HTML file?
I am converting a latex document that I used to compile with latex2html to htlatex. With latex2html, I used to do this to insert raw HTML code any where: \documentclass{article} \usepackage{html} \begin{document} \begin{rawhtml} any HTML code here \end{rawhtml} \end{document} - So I changed the above to \documentclass{article} \begin{document} \HCode{ any HTML code here } \end{document} but I get an error: -- htlatex foo.tex (./foo.aux) Runaway argument? { ! Paragraph ended before \HCode was complete. to be read again \par l.5 ? - 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. Using TL 2013 on linux mint. thanks, --Nasser
Re: [tex4ht] How to insert HTML code at any location in the generated HTML file?
On 7/10/2013 5:49 AM, Radhakrishnan CV wrote: On Wed, Jul 10, 2013 at 1:54 PM, Nasser M. Abbasi n...@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} h2This is HTML head 2 /h2 \end{verbatim} \end{document} --- the HTML generated will just look like this: h2This is HTML head 2 /h2 Which is clearly not what I wanted. regards, --Nasser
Re: [tex4ht] How to insert HTML code at any location in the generated HTML file?
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{div class=helloworld/div} \end{document} Regards, Michal 2013/7/10 Nasser M. Abbasi n...@12000.org: I am converting a latex document that I used to compile with latex2html to htlatex. With latex2html, I used to do this to insert raw HTML code any where: \documentclass{article} \usepackage{html} \begin{document} \begin{rawhtml} any HTML code here \end{rawhtml} \end{document} - So I changed the above to \documentclass{article} \begin{document} \HCode{ any HTML code here } \end{document} but I get an error: -- htlatex foo.tex (./foo.aux) Runaway argument? { ! Paragraph ended before \HCode was complete. to be read again \par l.5 ? - 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. Using TL 2013 on linux mint. thanks, --Nasser
Re: [tex4ht] How to insert HTML code at any location in the generated HTML file?
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{div class=helloworld/div} \end{document} Regards, Michal 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{div class=helloworld/div test %or any other HTML code } \end{document} -- htlatex foo3.tex --- (./foo3.aux) Runaway argument? {div class=helloworld/div ! Paragraph ended before \HCode was complete. to be read again \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?
On Wed, Jul 10, 2013 at 4:28 PM, Nasser M. Abbasi n...@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 n...@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} h2This is HTML head 2 /h2 \end{verbatim} \end{document} --- the HTML generated will just look like this: h2This is HTML head 2 /h2 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} h2This is HTML head 2 /h2 \end{html} \end{document} Best regards -- Radhakrishnan River Valleyhttps://maps.google.com/maps?q=River%20Valley,%20Thiruvananthapuram%20Neyyardam%20Road,%20Kerala,%20Indiavector=1