[tex4ht] Decimal comma and specing (bug?)

Hans Georg Schaathun georg+tex at schaathun.net
Wed May 11 14:05:17 CEST 2016


Dear Nasser and Michal,

thanks a lot for you replies.  The solution with siunitx is
a good one.  The old solution was both awkward, ad hoc, and
unnatural.  With siunitx it is only awkward :-)

Thanks again.

:-- Hans Georg

On Wed, May 11, 2016 at 01:06:31PM +0200, Michal Hoftich wrote:
> 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

-- 
:-- Hans Georg


More information about the tex4ht mailing list