I use tex4ht to compile my document.

In case if I use \vref command in my document, compilation fails with error:

Undefined control sequence

How to handle this situation?

  • Either this is a feature of tex4ht or you should show us what you have done so far – user31729 Jan 11 '16 at 20:53
  • We really need a mwe in this case, package varioref is supported by tex4ht and I've got no error in sample document with \vref command – michal.h21 Jan 11 '16 at 21:18
  • I made i little investigation, and it looks like if I use \usepackage{hyperref} and \usepackage{varioref}, compilation fails, otherwise if I use only \usepackage{varioref} compilation is successfull. However I need both packages. – Yulia Spryn Jan 12 '16 at 8:57

Ok, so it seems that there is an issue between hyperref and varioref with tex4ht:

% \let\vref\ref



And \vpageref{section}. 
And a range: \vrefrange{section}{second}


This fails with nice error message:

! TeX capacity exceeded, sorry [input stack size=5000].
<inserted text> 
l.9 See~\vref{section}

the issue seems to be caused because of clash between all three packages in way they write label information to the aux file. I don't know a system solution, but as a fix, we can just redefine \vref and \vpageref as ordinary \ref and \pageref. You will lost the on page part, but as in html there are no page numbers, it doesn't make sense anyway.

Try this .cfg file:


incidentally, \vrefrange seems to work without redefinition. This is a result with the configuration:

enter image description here

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.