[Tex/LaTex] \mathds from dsfont package works with latex and not with htlatex


When using dsfont package with latex, rendering is fine :


here the result :

latex result

Unfortunately, this doesn't work with htlatex :

htlatex result

I have also tried with :


but problem remains.

I suspect the 2 possibilities with dsfont and doublestroke packages on my MacOS.X. Indeed, I get the 2 following paths while searching for dsfont.sty :

$ locate dsfont.sty


Anyone has ever got this issue and is there a solution to get $\mathds{1}_{q}$ command with the same rendering as latex.


Best Answer

This issue is not caused by tex4ht, the math is rendered by MathJax. It seems that it doesn't support the \mathds command, so you need to provide some definition for MathJax. Moreover, it seems that it doesn't support blackboard numbers, so you need to find another solution, like providing direct Unicode value for doublestroke one. This can be done using custom macro for this symbol.

Try this TeX file:



The dsone can be defined in this way:

\Configure{@HEAD}{\HCode{\unexpanded{<script type="text/x-mathjax-config"> MathJax.Hub.Config({ 
        TeX: {Macros : {  mathlarger: ["{\\large \#1}",1], dsone: "\\unicode{x1D7D9}" }},
        "HTML-CSS": { mtextFontInherit: true }

This is the rendering:

enter image description here

Related Question