[tex4ht] How to add custom Css code into the configuration file? @media

Nasser M. Abbasi nma at 12000.org
Sat Oct 14 09:16:05 CEST 2023


On 8/30/2023 2:53 AM, Michal Hoftich wrote:
> Hi Nasser,
> 
>> Ok, fixed. Found my mistake. I forget to escape % and #
>> when I copied the code from the .css to try it in .cfg !
>>
>> This now works in the .cfg.
>>
> 
> In your case, you can use jurt \Configure{AddCss}{filename.css}. It
> will include link to the CSS file, which you need to place somewhere.
> The good thing is that you can use also URL. See
> https://www.kodymirus.cz/tex4ht-doc/Configurations.html#document-styling-using-css
> for more details.
> 
> Best regards,
> Michal

Hello Michal;

I found small problem using \Configure{AddCss}{...}

I currently have this in my .cfg file

     \Configure{AddCss}{/styles/css/nma.css}

Where /styles/css/ is folder that sits under the top of my server site. i.e.
in

             public_html/styles/

This has been working great. In the HTML geneated I see it creates this HTML
in the header:

<link href='/styles/css/nma.css' rel='stylesheet' type='text/css' />

Everything is great so far. Web server can see nma.css since it is under
public_html on the server (external or local server on my PC).

But now I wanted to use --output-dir option for make4ht. But now it gives error

make4ht  --shell-escape -ulm default -d REPORT ....

INFO]    mkutils: Copy: cp "/styles/css/nma.css" "REPORT/styles/css"
[ERROR]   mkutils: File /styles/css/nma.css doesn't exist
cp: cannot stat '/styles/css/nma.css': No such file or directory

It is because it is trying to copy the style file nma.css to the output directory!

And so ofcourse there is no folder /styles/css/ on the Linux disk. This is
meant only for the web server to use from its root public_html.

Why is make4ht trying to copy to the output_dir what is defined in \Configure{AddCss}?

Is there a way to not make it not do that? As this file is meant to
be global file sitting in one place and accessed from each web page
and this has to work for when using --output-dir and when not using this option.

Any suggestions how to make this work for both options?

Thank you,
--Nasser




More information about the tex4ht mailing list.