I want to generate accented characters (with dot bellow) in HTML from LaTeX using TeX4ht. This is my MWE.tex:





I get HTML using the following command:

$ make4ht -l MWE.tex

The result in TeX Live 2022 looks as follows: dot is missing under ŕ

This is not quite correct: the dot is missing under ŕ. The generated HTML looks as follows:

<p class='noindent'>ṣ</p>
<p class='indent'><span class='accentd'>ŕ</span></p>

This is not too bad. I have implemented a workaround using XSLT that post-processes the HTML file and replaces the span element with ŕ&#x323; (using the 'Combining Dot Below' Unicode character), which produces the desired result.

Now, after updating my system (to Ubuntu 23.10), I am using Tex Live 2023. The result looks like this now: the second character is a picture of x with dot bellow

Where the x with dot bellow is an image now and not a character (and a wrong one at that: I want ŕ, not x). The generated HTML looks as follows:

<p class='noindent'>ṣ</p>
<p class='indent'><img alt='ŕ.  ' class='d' src='accents0x.png' /></p>

To me, this is a clear regression from Tex Live 2022.

My questions:

  1. Can I get the same result in Tex Live 2023 as in Tex Live 2022? (Which I can easily fix with my workaround).
  2. Is there a solution where I don't have to use any workarounds? That would mean: \d{s} translates to and \d{ŕ} translates to ŕ&#x323;.

1 Answer 1


I had to change handling of accents because of issues in the math mode. For example, $\widehat$ wasn't working. You can get the original handling of accents with this configuration file:

        {\ifmmode \expandafter\mathord\fi
\if !#1!\ht:special{t4ht@+&\#x#2;}%
\else \expandafter \ifx\csname U#2#1\endcsname\relax
    \ht:special{t4ht@+&{35}x\csname U#2#1\endcsname;}%
\fi \fi x%
        {\ifmmode \expandafter\mathord\fi
          {\HCode{<span class='accent#1'>}#3\HCode{</span>}}}

It produces this HTML:

<!-- l. 5 --><p class='noindent'>ṣ
</p><!-- l. 7 --><p class='indent'>   <span class='accentd'>ŕ</span>

To add the dot below, you can use this make4ht build file instead of XSLT:

local domfilter = require "make4ht-domfilter"
local process = domfilter {
    for _, el in ipairs(dom:query_selector(".accentd")) do
      local accent = el:create_text_node(utf8.char(803))
    return dom

Make:match("html$", process)

It loops over the accentd elements and add the combining dot. Compile using:

$ make4ht -e build.lua -c config.cfg sample.tex

This is the result:

enter image description here

<!--  l. 5  --><p class='noindent'>ṣ
</p><!--  l. 7  --><p class='indent'>   <span class='accentd'>ṛ́</span>
  • Thanks a lot, that solves my problem for now! I actually do more XSLT post-processing than just this, so I guess I'll stick with my fix, but it's good to know there's another option. I was wondering: Are you going to change the accent handling to make it more robust in the future?
    – texrob
    Dec 14, 2023 at 15:01
  • @texrob you can still call XSLT from the build file. It has the upside that it can call a command on all output files. If you create only one HTML file, then it doesn't matter, but if you produce more files, it can be useful. Regarding accents, I don't know. As there are multiple issues related and fixing of one creates another. I will try to do more tests tomorrow, but I am not sure I will come with a good solution.
    – michal.h21
    Dec 14, 2023 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .