3

I use \vref{something} to reference to figures. As long as this is in regular text everything is fine. But When I surround this with brackets like this (\vref{something}) then is the result is a preceding space in front of the reference:

Some text ( figure 1.1), some more ...

How can I avoid the space between the opening bracket and the word figure to get a result like this:

Some text (figure 1.1), some more ...

MWE:

\documentclass[10pt,a4paper]{article}
\usepackage{caption}
\usepackage{varioref}
\usepackage{fancyvrb}

\begin{document}
 some text (\vref{fig:1}) some more ...



\begin{minipage}{.8\linewidth}
   \captionsetup{type=figure}
   \captionof{figure}{MWE}\label{fig:1} 
   \begin{Verbatim}[frame=single,baselinestretch=1,fontsize=\footnotesize]
something to show
   \end{Verbatim}
\end{minipage}

\end{document}
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – egreg Sep 23 '14 at 19:44
  • Did you consider using the \cref command provided by the cleveref package instead? I used that for my thesis and it didn't have spacing problems. – Fritz Sep 23 '14 at 21:18
  • \vref doesn't add “figure”; if I type some text (figure \vref{fig:1}) I get no spurious space. The \vref* command doesn't add the space (see section 2.2 in the documentation). – egreg Sep 23 '14 at 21:25
  • @egreg: Oh, you're right, I didn't compile it. Mainly because the question text implied something else. Anyways, \cref is still a good idea in my opinion. ;-) – Fritz Sep 23 '14 at 21:30
  • \fref from fancyref is very useful. [I used it for all the cross-references in my doctoral dissertation and didn't have spacing issues.] It has advantanges and disadvantages in comparison with cleveref. – cfr Sep 23 '14 at 23:51
4

Use \vref* instead of \vref. The starred versions were created specifically for removing this space at left. View section 2.2 of the varioref's documentation.

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.