I'd be very interested to know what babel does to that enables the advanced hungarian accents to be loaded. The comments below indicate that it should really have no affect. Given the experience and brilliance of those responding their probably right. That being said, it is doing something as it definitely gives me a scaleable character when I use it. Since babel on it's own is interfering with cleveref I'd like to extract whatever part it's providing that character (recognizing that it's probably not changing encoding or anything) and just use that snippet.


  • Document with cref and figure environments
  • Custom figure environment is setup to let me build a complex paneled figure (considerable code not shown)
  • The figure caption may include an enumerated list
  • The overall figure label has trouble being referenced** when there is an enumerate environment in the figure caption
  • The "\cref{figure}" reference is, for some reason with htlatex and babel is not being applied to the figure label, but is being recognized as the last label used in the enumerate environment
  • Strangely the \label location in the caption doesn't matter; it can follow the list and this will still fail
  • This problem does not appear following pdf compilation
  • This problem only appears in htlatex when babel is used

So this MWE should compile just fine with xelatex it does on my computer. Unfortunately while it compiles completely with htlatex as well, I get a problem with the cref command. I only get this problem if I include babel, otherwise the htlatexcompile result is accurate as well.

In the html file, where I would expect to see (like the pdf):

Reference: Fig. 1

Instead I see:

Reference: item (iii)

Which tells me that somehow the environment I've created/used is using the last possible label from the enumerate.

MWE - Including customizations that may interfere with solution

%%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, oneside, letterpaper]{article} %oneside twoside







\DeclareDocumentCommand{\PanelledFigure}{ O{7.0625 in} o O{1.25}}

%%%%%%%%%%%%%% CULPRIT LINE %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% CULPRIT LINE %%%%%%%%%%%%%%%%%%%%




    Reference:  \cref{fig:ref}

        Little figure summary here that provides extra details:  
            \item first example;
            \item another example;
            and \item last example.


It looks like cleveref doesn't yet support Hungarian and this argument is actually the part that is causing problems.

So the problem is now less about cref, and more about how to insert complex characters such as those found in Hungarian, when compiling with htlatex. When I compile the following, I get two blurry png images inserted that needs to be worked around.

%%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, oneside, letterpaper]{article} %oneside twoside



    \usepackage{textcomp} % needed for degree sign or something with tex4ht

    % No defaults to set yet




% These packages won't work in html, so only include if using the pdf generation.

        \usepackage{polyglossia} % loads fontspec (font selection with XeLaTeX and LuaLaTeX - load open type fonts)

        SmallCapsFont={TeX Gyre Termes},
        ]{Times New Roman}

        %\setmainfont[Mapping=tex-text]{TeX Gyre Termes}
        %UprightFont= *-regular,

        % This will likely need improvements to fonts and languages still


Text with a complex accent \H{o} or \H{u} 
  • Why are you loading enumerate and enumitem? What is the command to compile this document with htlatex? In my point of view you're abusing the PanelledFigure macro as an environment, which isn't really – user31729 Jan 14 '18 at 1:00
  • Also \usepackage[english]{cleveref} seems to be a better way – user31729 Jan 14 '18 at 1:06
  • I no longer remember why enumerate is being loaded, but I load enumitem because I need to customize the label's appearance and I found efficient solutions to customize my list aesthetics with enumitem. Before updating my question with the compile info, as the compile script I wrote is very complex, but usable by, the MWE, I will do a quick a quick MWE test of common/simple htlatex compile sequences to verify this is simply reproducible. If you tried this with your own preferred htlatex sequence and observed the failed picture import with example-image-a.jpg that is what I see to. – EngBIRD Jan 14 '18 at 1:07
  • 1
    @ChristianHupfer The babel is used because I was unable to find a way, short of using it, to get a few Hungarian accents (in my bibliography) to display without appearing as a horrible png image of the accented character. – EngBIRD Jan 14 '18 at 1:08
  • 1
    @EngBIRD: babel is not interfering with cleveref -- no one has written the relevant \crefname etc. settings for Hungarian and various other languages so far. By default cleveref uses English, it has support for German, Dutch, French, Spanish, Italian, Russian, Ukrainian, Norsk, Danish, Esperanto (!), Swedish and Brazilian. – user31729 Jan 14 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.