[tex4ht] Decimal comma and specing (bug?)

Michal Hoftich michal.h21 at gmail.com
Wed May 11 13:06:31 CEST 2016


Hi Hans,

>>
>> typesetting of decimal numbers in languages which use a
>> decimal comma instead of a point (i.e. most languages
>> except English AFAIK :-) is a well-known challenge.
>> The standard TeX solution does not work in tex4ht though.
>>
>> A quite typical example would be this:
>> $\Delta t = 24, 6, 2, 0{,}5, 0{,}1$.
>> In regular TeX, the braces around the commas ensures that there
>> is only intra-word spacing around the comma.  Thus, the bracketed
>> commas appear as decimal commas, while the unbracketed ones are
>> list separators with some spacing after.
>>

this feature would be hard to implement, I am afraid. The mathml code
for your example is added by tex4ht comand. It means that it tries to
add structure based on font information in the DVI file, as opposed to
tags inserted in the configurable hooks. In the DVI file, there is
only following structure:

          fnt: cmr10 at 10pt
          set: '6'
          fnt: cmmi10 at 10pt
          set: ';'
          w0:
          fnt: cmr10 at 10pt
          set: '2'
          fnt: cmmi10 at 10pt
          set: ';'
          w0:
          fnt: cmr10 at 10pt
          set: '0'
          push:
            fnt: cmmi10 at 10pt
            set: ';'
          pop:
          x: 2.777786pt
          fnt: cmr10 at 10pt
          set: '5'

so the coma in braces is surrounded by `push` and `pop` instructions.
You can also see that it is `;` character instead of `,`, in the DVI
file there is no actual character, but only pointer to to glyph at
that position in the font. We can get the character through mapping in
the HTF files. The problem is, the tex4ht command is written in C and
it seems that nobody understand it, so it is quite unlikely that we
can fix it.

As a workaround, you can use Siunitx as Nasser suggest, or some custom
macro which would insert correct MathML elements.

Best regards,
Michal


More information about the tex4ht mailing list