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.

My question is in the title of this post, but extends to other referencing commands like \eqref, \citep, \citet (and the like) as well.

share|improve this question
2  
I'd say this is somehow a duplicate of Good practice on spacing; it's a subcase of that question, even though this is not obvious from the question. –  Hendrik Vogt Jan 25 '11 at 7:56

2 Answers 2

up vote 30 down vote accepted

The ~ is a non-breaking space, (not really a symbol) so when you write in your text Table~\ref{mytable} it ensures that the Table part is kept together with the number. This is generally considered to be good for readability.

So that you don't forget, it's often helpful to make macros for references like these:

\newcommand*{\tabref}[1]{\tablename~\ref{#1}}
\newcommand*{\figref}[1]{\figurename~\ref{#1}}

Then you use \tabref{mytable} and \figref{myfig} in your text.

The refstyle package provides a generalised interface to automatically construct macros like those above.

The cleveref package with its \cref command is even more powerful, since it figures out what type of object your reference refers to and generates the correct text automatically (so you don't need different \ref commands for different reference types.)

If you are independently using the hyperref package, it also provides an \autoref command that works like cleveref's \cref command (and also makes the hyperlink target larger.)

share|improve this answer
4  
I recommend refstyle or cleveref for handling referencing macros. (As an extention to your macros.) Makes life much easier, I think. –  Will Robertson Jan 24 '11 at 21:18
2  
Or you can use the cleveref package and then only call \cref{mytable} instead of Table~\ref{mytable}. –  Jake Jan 24 '11 at 21:18
    
@Will (and Jake) Thanks for the suggestions about refstyle and cleveref; I've updated my answer. –  Alan Munn Jan 24 '11 at 21:25
1  
hyperref also has \autoref which performs much the same job. –  Seamus Jan 24 '11 at 22:39

The ~ is called a tie because it ties two words together like in Section~\ref{sec:intro}. The tie causes TeX never to break a line at a tie. Hence, Section and the reference will end up together on the same line, making them easy to read. Tying together what belongs together is good practice and is not limited to \ref. Another good use is tying an academic title to a name.

share|improve this answer
2  
or 75~kg for example –  Herbert Jan 24 '11 at 21:31
    
It is good for salutations like Dr. Mr. etc and also suffixes to name like sr. Jr. I II III etc. –  Aku Jan 25 '11 at 17:48
1  
should be typeset as Dr.\,Hyronymous~Bosch –  Herbert Jan 25 '11 at 17:59
    
@Herbert I think a ` after the dot is better (unless you're using \frenchspacing, but still...); the thin space is too small. Also I don't understand why Hyronymous (Hieronymus really) and Bosch should be tied. H*` is the first name and Bosch the surname, which shouldn't be tied (Otherwise you might as well tie George and Bush and I don't want any ties with them.) –  Marc van Dongen Feb 28 '12 at 18:25
    
@Herbert: While many of Knuth's ideas were "good", not all are practiced in the typesetting world outside of the TeX universe. Here are a few of examples: While people never line-break between numbers and units, there is no obvious prohibition against linebreaks between first and middle name or middle name and last name (judging from general practice). \frenchspacing has been the norm in the US (and elsewhere even more so) outside of a typewriter context for many decades. Vertical line stretching is rarely done, if ever. But it certainly makes sense to use ~ for figures and tables. –  Lover of Structure Jun 13 '12 at 19:17

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.