I'm running MiKTeX under Windows 7, trying to compile some LaTeX to HTML using htlatex.

htlatex appears to be converting every instance of 'ff' and 'fi' with a NUL byte in the HTML. Was wondering if anybody had any insight!

Here's the config file I'm using (some stuff I got on the internet that is probably the whole problem):


And here is an example tex file that illustrates my problem:



\subsection{Valid Letters}
AA Aa aA aa\\
BB Bb bB bb\\
CD Cd cD cd\\
\subsection{Invalid Letters}
FF Ff fF ff\\
FI Fi fI fi\\

a string of text\\
a fine string of text\\
a definition of an efficient and fine string of text\\
finally, the problem is solved!\\


And here is output I get after running the the command

htlatex example.tex MyFonts.cfg "xhtml, NoFonts, -css" -utf8 -shell-escape

1 Letters

1.1 Valid Letters

AA Aa aA aa
BB Bb bB bb
CD Cd cD cd

1.2 Invalid Letters

FF Ff fF
FI Fi fI

2 Strings

a string of text
a ne string of text
a denition of an ecient and ne string of text

nally, the problem is solved!

If I look in the HTML output, all occurences of 'ff' and 'fi' have been replaced by the NUL character. Does anybody know why?


  • 1
    I saved the first snippet as MyFonts.cfg, but NoFonts gives error; if I remove it, I get errors because of -utf8 and -shell-escape.
    – egreg
    Feb 27, 2014 at 0:15
  • The error seems to be caused by the -css argument... but why? Also, you can replicate the error (or I can) with just the following command htlatex minimal.tex MyFonts.cfg "xhtml, -css" Feb 27, 2014 at 0:20
  • With that command line I get, for instance, a fine string of text in the .html file.
    – egreg
    Feb 27, 2014 at 0:22
  • hm. For some reason the -css is killing it for me. Feb 27, 2014 at 0:31

1 Answer 1


You compile it in a wrong way.

Correct compiling order is:

htlatex filename "tex4ht.sty opt" "tex4ht command opt" "t4ht command opt" "latex opt"

in your case this means this command:

htlatex filename "MyFonts, NoFonts, -css" " -utf8" "" -shell-escape

this generates fine html for me.

some further notes:

you request -utf8 option for tex4ht command, but you doesn't provide option for unicode fonts -cunihtf or -cmozhtf, so generated html is in latin-1 encoding. correct compile sequence for unicode is:

htlatex filename "MyFonts,  NoFonts, -css, charset=utf-8" " -utf8 -cunihtf" "" -shell-escape

note that in this case ligatures are transformed to unicode characters, which maybe isn't what you want. you can simplify the process with my make4ht tool:

you can move options for tex4ht.sty to the cfg file:

\Preamble{xhtml,NoFonts, -css}

so you don't need to specify them on the command line. Now you can simply call:

make4ht -u -c MyFonts -s filename 

also note that NoFonts option may be dangerous - if you add to your tex file:

\textbf{příliš} \emph{žluťoučký} \textit{ďábelské}



generated html looks like:

<b>Hello příliš</b> <em>žluťoučký</em> ďábelské 

you can see that there are html tags for \textbf and \emph, because you provided configuration for these commands, but \textit doesn't produce any markup. If you remove NoFonts option, due to bug in tex4ht command, lot of unnecessary elements around accented characters are produced, which is probably reason why you use NoFonts. To fix this issue, you can configure \textbf and \emph to turn html fonts off:


but if you don't want to provide such configurations for all font changing commands, you can use make4ht filters. create make file filename.mk4:

local filter = require "make4ht-filter"
local process = filter{"cleanspan", "fixligatures", "hruletohr"}

three filters are used in this sample:

  • cleanspan removes spurious span elements around accented letters
  • fixligatures replaces ligatures with base characters
  • hruletohr replaces series of ----- characters with <hr /> element

if you remove the NoFonts option, generated html is now:

<b>příliš</b> <em>žluťoučký</em> <span class="cmti-10">ďábelské </span>

so even if \textit doesn't produce semantically meaningful code, the text is italicized thanks of css.

  • Here (make4ht from TeXlive 20190410 as shipped by Fedora 32) the "fixligatures" doesn'f xix anything, ligatures get translated into NUL characters
    – vonbrand
    Aug 24, 2020 at 23:34
  • @vonbrand do you get NUL characters for the OP's example? It works for me in TL 2020. If you get NUL characters, it probably means some issue in font mapping. It can happen for some font combinations.
    – michal.h21
    Aug 25, 2020 at 8:19

You must log in to answer this question.

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