[tex4ht] is it possible to define a Latex environment, where one can issue direct HTML code in it for tex4ht only?

Michal Hoftich michal.h21 at gmail.com
Fri Jun 10 12:40:49 CEST 2016


>
>
> Thanks  Michal;
>
> This is really neat. I never knew how to do all the above before.
> never used .sty and .4ht before and how they are used. (is
> there a basic user-guide tutorial on these things?)
>

Sure :)

https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial#configurations

> But I have 2 small questions:
>
> I see the first line of the listing showing up in HTML shifted
> to the right from the rest of the code. But it should be PRE,
> so it should not get indented in any way?
>
> If you run  make4ht --lua foo.tex on :
>
>
> With your supplied mycode.4ht and mycode.sty in the same folder,
> you'll see the HTML shows this:
>
> ------------
>  X=10;
> y=5;
> z=20;
> -------------
>

I don't get a space, it is really weird.
>
> The second question: I see no \ifdefined\HCode anywhere. How
> does it know to use listings package, when compiled with
> pdflatex or lualatex, and to use the HTML ScriptEnv/HTML part
> when  compiled with make4ht? I am confused on this part. Is there
> some implicit \ifdefined\HCode going on under the hood here?
>

The configurations are being read from the .4ht file automatically by
tex4ht, there really isn't need for use of \ifdefined\HCode, on
contrary, it should be used as last resort. Correct solution is to put
your macros to .sty file and provide .4ht file with tex4ht
configurations.

Best regards,
Michal


More information about the tex4ht mailing list