Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to use \vpageref and have a comma right after it. The problem is that a space is inserted even though I defined \reftextcurrent to be {}. In the example below I could fix this by adding the [] to \vpageref, but in my book this trick somehow does not work. Is the additional space a bug? How can I fix it?

\documentclass{article}
\usepackage{varioref}
\renewcommand{\reftextcurrent}{}

\begin{document}

\section{Test}

I have a problem with Figure~\ref{test}\vpageref[]{test}, which I cannot solve.

\begin{figure}[b]

\caption{A figure}
\label{test}
\end{figure}


\end{document}
share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Use the starred version \vpageref* or, even better, replace the \ref/\vpageref combo with \vref.

(The additional space before [!] \vpageref is an unfortunate design decision; see section 2.2. of the varioref manual for details.)

\documentclass{article}

\usepackage{varioref}

\renewcommand{\reftextcurrent}{}

\begin{document}

\section{Test}

I have a problem with Figure~\ref{test}\vpageref*{test}, which I cannot solve.

I have a problem with Figure~\vref{test}, which I cannot solve.

\begin{figure}[b] 
\caption{A figure}
\label{test}
\end{figure}

\end{document}

enter image description here

share|improve this answer
    
Thanks! How silly not to take \vref in the first place. I use it at other places, but started with \ref and then thought about adding the page reference. Thanks anyway. Maybe we delete this question. Sort of embarrassing ... –  Stefan Müller Oct 11 '12 at 19:49
add comment

As an alternative (perhaps you've already written the book in a specific style, without knowing about \vpageref* or \vref...), you can

\renewcommand{\reftextcurrent}{\unskip}

This removes the skip that you see, and you don't have to change your code.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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