# adjusting formatting of footnotes in tex4ht's .docx output

A default Word document formats footnotes as follows: at the bottom of the page, the footnote hook (e.g., the number '1') appears in superscript, then there is a space, then the footnote text begins. The ruling on the left and right is the same as the main text above.

When I run tex4ht (and then convert the .odt output to .docx format), the result formats footnotes quite differently: it begins with the footnote hook not in superscript, then includes a tab instead of a space, then begins footnote text. The footnote text is ruled with a hanging indent.

Is there a way to adjust tex4ht's output so that the footnotes are formatted according as in Word's default?

MWE:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt,article,oldfontcommands]{memoir}

\begin{document}

%%%%%%%%%%%%%%%%%%%%
%%%    My text goes here:    %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

Text.\footnote{This is a long footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote. This is a footnote.}

%%%%%%%%%%%%%%%%%%%%
%%%    My text ends here:    %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

\end{document}


LaTeX output:

Default MS Word output:

tex4ht output:

# Update based on @Michal.21's answer

When I tested @Michal.21's answer, I got odd output after converting to Word:

From looking at the invisible characters, it looks like what's going on is not an extra line but rather something is off about the superscript "1":

Is there a way to tweak the .cfg file so that it is compatible with Word?

The trouble seems to be that rather than use the "Superscript" feature, the "Footnote Characters" (as the Style of the footnote label down below is called in MS Word) font is "8.5 pt, Raised by 12 pt":

By contrast, the "Footnote Anchor" style (for the references in the main body text pointing down to the footnotes) is "Superscript":

So perhaps one could simply enter the same font information for "Footnote Characters" as is currently used for "Footnote Anchor"?

• As this example shows, tex4ht also makes the footnote text 12-point instead of 10-point (as in both the LaTeX output and the MS Word default). It would be nice to be able to tweak that automatically as well. – Alex Roberts Feb 10 '19 at 1:53
• It occurs to me that the failure to make the footnote hook superscript could be not intentional but rather a result of the bug I identified here whereby the \textsuperscript command does not work within footnotes in tex4ht output. – Alex Roberts Feb 10 '19 at 3:58

I've took a look at the footnote styling code in a file generated by LibreOffice and extracted the following code:

\Preamble{xhtml}
\ConfigureOO{Footnote}{
<style:style
style:name="Footnote"
style:family="paragraph"
style:parent-style-name="Standard"
style:class="extra">\Hnewline
<style:paragraph-properties
fo:margin-left="0.2in"
fo:margin-right="0in"
fo:text-indent="-0.2in"
style:auto-text-indent="false"/>
<style:text-properties fo:font-size="80\%"
style:font-size-asian="80\%"
style:font-size-complex="80\%" />
</style:style>\Hnewline
<text:notes-configuration text:note-class="footnote"
text:citation-style-name="Footnote_20_Symbol"
text:citation-body-style-name="Footnote_20_anchor"
style:num-format="1" text:start-value="0"
text:footnotes-position="page"
text:start-numbering-at="document" />\Hnewline
<style:style style:name="Footnote_20_Symbol"
style:display-name="Footnote Symbol" style:family="text" >\Hnewline
<style:text-properties style:text-position="super 70\%" />\Hnewline
</style:style>
<style:style style:name="Footnote_20_anchor"
style:display-name="Footnote anchor" style:family="text">
<style:text-properties style:text-position="super 58\%" />\Hnewline
</style:style>\Hnewline
}
\begin{document}
\EndPreamble


It seems to do the trick:

• Sorry for the ignorant question, but where should I put this code to make it work? I tried putting it in the preamble to the TeX document to be converted to ODT/Word, but it did not have the desired result. – Alex Roberts Mar 31 '19 at 17:22
• @AlexRoberts no, you should put it to a .cfg file, which then needs to be included using the -c option of make4ht – michal.h21 Mar 31 '19 at 17:31
• Ah, thank you! I've just tested it out, and somehow the output is a bit odd after the conversion to Word. I'm not sure what's going on, but maybe it's that the superscript isn't converting properly? I'll edit my question to put a screenshot of the output. – Alex Roberts Mar 31 '19 at 21:14
• I'm guessing it has to do with <style:text-properties style:text-position="super 58\%" /> but don't know what the number should be changed to. – Alex Roberts Mar 31 '19 at 21:19
• @AlexRoberts I cannot test it in Word, so it is hard to say. Maybe opening and saving the file in LibreOffice could help? (it helps in some cases, I am not sure about this one) – michal.h21 Apr 1 '19 at 18:43