tex4ht: Cannot compile document with \vref command

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:

\documentclass{article}
\usepackage{hyperref}
\usepackage{varioref}
% \let\vref\ref

\begin{document}
\section{first}\label{section}

See~\vref{section}

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

\section{second}\label{second}
\end{document}


This fails with nice error message:

(./sample.aux)
! TeX capacity exceeded, sorry [input stack size=5000].
<inserted text>
macro:->
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:

\Preamble{xhtml}
\makeatletter
\let\vr@f\ref
\let\vp@geref\pageref
\makeatother
\begin{document}
\EndPreamble


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