2

I use htlatex to generate an html file with this command:

htlatex filename.tex "html,1,sections+"

I ran into a problem where the output used iso-88859-1 instead of utf-8, which was solved: Use utf-8 encoding instead of iso-8859-1

The solution was to run the command with these arguments:

htlatex filename.tex "xhtml,charset=utf-8" "-cmozhtf -utf8"

Which makes the encoding come out correctly. However, I now can't seem to incorporate all of the command line options that I need. (I.e., 1 and sections+ with the utf-8 related options).

I tried shooting in the dark with a few variations:

# encoding ends up wrong:
htlatex filename.tex "xhtml,charset=utf-8,1,sections+" "-cmozhtf -utf8"
# sectioning ends up broken:
htlatex filename.tex "xhtml,1,sections+,charset=utf-8" "-cmozhtf -utf8"

Obviously I'm just shooting in the dark here. I checked documentation here: https://www.tug.org/applications/tex4ht/mn-commands.html#QQ1-9-34. The syntax is supposed to be:

htlatex filename "options1" "option2" "options3" "options4"

I assume the issue is that I'm not ordering the "options1" portion correctly, but I'm not sure and I can't find more informative documentation. I'm looking for either the correct syntax or documentation that addresses this issue.

J Jones
  • 225

1 Answers1

3

This is why it is better to use make4ht instead of htlatex. I forgot that it is necessary to add space before " -cmozhtf -utf8", otherwise the first option is ignored and you will get wrong encoding, because wrong conversion table will be used. I don't think there should be any difference regarding output of "xhtml,charset=utf-8,1,sections+" and "xhtml,1,sections+,charset=utf-8", both versions are correct. Only the first option is important, order of the rest doesn't matter.

So correct call to htlatex is:

 htlatex sample "xhtml,1,sections+,charset=utf-8" " -cmozhtf -utf8"

It is simpler using make4ht:

make4ht -u sample.tex "1,sections+"
michal.h21
  • 50,697
  • 1
    Thanks! The command appears to work. I have been struggling to install make4ht without success so far. https://github.com/michal-h21/make4ht/issues/11 – J Jones Mar 29 '18 at 20:57