`hyperref` makes `varioref`'s `\vrefformat` no-op
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 205
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Currently, hyperref makes varioref's user customization option \vrefformat no-op, as shown in the MWE below:
\documentclass{article}
\usepackage[nospace]{varioref}
\usepackage{hyperref}
\renewcommand*{\vrefformat}[2]{%
Foo \ref{#2} \vpageref[#1]{#2}}
\begin{document}
\section{Section 1}
\label{sec:section-1}
\clearpage{}
\vref{sec:section-1}
\end{document}
Renders:

Commenting hyperref out of the above document renders:

This happens because hyperref redefines \vr@f and \vref@star (I haven't tested, but I presume the same problem occurs with \Vref for the same reason). And does so without using \vrefformat (and \Vrefformat), but hard-coding the formats in the redefinitions it makes.
As far as I can tell, this is done at: https://github.com/latex3/hyperref/blob/c25f44c5d880a5897376d947957e7a129b376e6c/hyperref.dtx#L13027-L13058
I don't know if there's a reason for this that I've missed, but it seems possible, at first glance, to use \vrefformat instead of hard-coding it (maybe redefining \vrefdefaultformat for this). And thus not override this user option from varioref.
Edit: Besides what was already mentioned, the above also means that \usepackage[japanese]{varioref} won't work with hyperref (well, theoretically at least, I don't actually know how to set up a document in Japanese).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with hyperref.dtx around lines 13027–13058, focusing on the redefinitions of \vr@f and \vref@star, then compile the supplied LaTeX MWE with and without hyperref. Confirm that a customized \vrefformat is honored when hyperref is loaded, and investigate whether the corresponding \Vref behavior is also covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100