babel causing cref mistakes to labels when compiled with htlatex

by EngBIRD   Last Updated January 14, 2018 01:23 AM


  • 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.

Related Questions

Language dependent conjunctions in cleveref

Updated March 27, 2018 09:23 AM