# [tex4ht] How to include Configuration commands inside the .tex file and not in separate file?

Michal Hoftich michal.h21 at gmail.com
Sat Jun 1 19:41:15 CEST 2013

You don't need \Preamble and \EndPreamble in your document, they are
useful only in config file. You can use \Css, \Tg or \ConfigureEnv,
but only after '\begin{document}'. Something like this should work:

\documentclass{article}
\usepackage{somepackage}
\begin{document}
\ifx\HCode\undefined \else
\Css{body{background-color:green;}}
\ConfigureEnv{quote}{\Tg<quote>}{\Tg</quote>}{}{}
\fi

\ifx\HCode will ensure that this code run only when tex4ht is loaded.

Regards,
Michal

2013/6/1 Nasser M. Abbasi <nma at 12000.org>:
> I can't get the syntax right, or even if this is possible.
>
> I was just trying to find out, if I can put the htlatex configuration
> inside the latex file itself instead of inside the .cfg file
> (just to test things, while trying something).
>
> I know I can use the \HCode{} inside the latex file itself.
>
> But not able to figure how to add all the other commands,
> such as \ConfigureEnv, \Preamble, \EndPreamble, \Css, \etc...
> I tried so many things, and keep getting different errors
> each time I try.
>
> Searched many places, and they all just show how to
> use these commands via a separate configuration file.
>
> Is it possible to add these in the latex file?
>
> Where will they go? in the preamble I assume.
>
> command I use to compile now is
>
> htlatex foo.tex "my_config_file,htm"
>
> So new command should become
>
> htlatex foo.tex "htm" where the content of the my_config_file.cfg
> now goes inside the foo.tex somehow. (again, this is just
> for testing, I just wanted to see if it is possible and how)
>
> thanks,
> --Nasser
>
>
>