7

The code at the bottom produces

See equations (1) and (2) on page 6 and on page 11.

What I'd like is

See equations (1) and (2) on pages 6 and 11.

Otherwise it looks quite strange in my opinion. Is there an easy way to do that?

\documentclass{article}

\usepackage{lipsum}
\usepackage{varioref}
\usepackage[nameinlink,noabbrev]{cleveref}

\begin{document}

See \vref{eq:1,eq:2}.

\newpage
\lipsum
\newpage
\lipsum
\newpage

\begin{equation}
  \label{eq:1}
  e=mc^2
\end{equation}

\newpage
\lipsum
\newpage
\lipsum
\newpage

\begin{equation}
  \label{eq:2}
  e=mc^2
\end{equation}

\end{document}
  • See \cref{eq:1,eq:2} on \cpageref{eq:1,eq:2} – Fran May 6 '13 at 17:50
  • Well, yes, but that defeats the purpose of varioref and is more like a last-resort approach in my opinion. Still, thanks for the suggestion! :) – letmaik May 6 '13 at 19:02
3

The answer to the question "is it easy" is probably no, though with enough programming effort it could be done (as nearly everything can).

Reasons:

  • First of all, what would be the spec, if, for example, the ref would be on page 2, the first eq on page 3 and the second on page 5: "see equation (1) and (2) on the next page and page 5" or ".. on pages 3 and 5".
  • Or if the first eq would be on the first page and the second on the third, should that result in "... on the previous and the next page" or "... on the previous page and the next page"?

Assuming those specs are defined, then cleverref would need to get a completely different programming logic as it currently doesn't deal with that complexity at all.

Furthermore this gets very much into language structure questions and difference, i.e., in some cases we end up with "page" sometimes with "pages". For this there are no predefined language fragments stored for the various languages (which would need to get added).

In addition one needs much more than translatable fragments. In many cases the sentence structure very much depends on the target language as well (so you will need different logic at least for some languages). For example, if the eqs are on pages 3 and 4 I would prefer seeing "... auf der nächsten und übernächsten Seite" or "... auf den Seiten 3 und 4" (plural for page) or "... auf Seite 3 und 4" (no plural in that version). Thus the moment varioref would detect that it is the "next" page the sentence structure would change and move the word page to the end.

So in summary, I think this is a very interesting question but any automation as attempted by varioref and cleverref will show limits in boundary cases and to overcome them you will end up with a lot coding and probably still some strange cases that are not catered for.

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.