[tex4ht] superscript with tex4ht

Michal Hoftich michal.h21 at gmail.com
Thu Jan 11 13:04:38 CET 2018

Dear Alex,

> When I have `\textsuperscript{r}` in my document, tex4ht produces output
> that elevates the "r" not by using Word's "superscript" feature (Format >
> Font... > Effects > Superscript). Instead it seems to decrease the font size
> manually (from 12pt to 9.5pt) and elevate it some other way. (Example input
> and output attached.) The result is unfortunate, because this elevated "r"
> disrupts the document's overall line spacing. I am also concerned that the
> publisher's software won't know what to do with it, so that it will continue
> to look bad.

I think this issue is on Word's side. tex4ht creates text styled with
style:text-position="super 80\%" property. LibreOffice can display it
correctly. I also compared code created by LibreOffice when I created
a superscript manually and it seems that the only difference is that
it uses "super 58%" as a value for text-position property. When I
tried to change the tex4ht style to use this value, Word could open it
as well. So it seems that Word has some hard-coded rules that
superscript is only text with "super 58%" text-position.

Anyway, I don't think that 80% which tex4ht uses has any deep meaning,
so we can use 58% instead. I also found that there was missing for
\textsubscript, which is now part of LaTeX core, so I added the
support for it to both ooffice and HTML formats.

You can use the following config file until the update gets to TeX Live:

  {\HCode{<text:span text:style-name="textsuperscript">}}
<style:style style:name="textsuperscript" style:family="text">\Hnewline
   <style:text-properties style:text-position="super 58\%"/>\Hnewline

Best regards,

More information about the tex4ht mailing list