TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Referring to the body below, I would expect ~\ref{atts} to produce Table 1, but instead, it gives just 1.

What is the issue here?

share|improve this question

You have to use some package that knows what you are referring. I suggest cleveref:



\caption{Categories and example of attributes}
\begin{tabular}{l p{8.0cm} l}
Variable & Items & Category \\
Built-up area  & Inside built-up area; outside built-up area & !!!CAT!!! \\
Type of road  & Highway; district or province road & !!!CAT!!! \\
Type of road lanes  & Road with one road lane; road with separated road lanes & !!!CAT!!! \\
Intersection  & Near intersection; outside intersection & !!!CAT!!! \\
Location characteristic  & Road works; bridge; tunnel; railroad; roundabout & !!!CAT!!! \\
Road factors  & Bad road surface; faulty signals; faulty lighting; road works; queue; downhill; curve; bad visibility & !!!CAT!!! \\
Miscellaneous  & Accident following accident; aquaplaning; sun blinded; school; recreation centre; bus stop; person swung out of vehicle; no safety belt; no helmet; no child seat; cargo on roadway before accident; cargo on roadway because of accident; fire after accident; comments & !!!CAT!!! \\
Total number of deaths  & 0; 1; 2; 3; 4; 5 & !!!CAT!!! \\ [1ex]

~\Cref{atts} is bad.


enter image description here

For details, refer to the documentation -- execute texdoc cleveref from command prompt.

share|improve this answer

Since you did not specify any example, I just have to guess: The \ref{} command does not know if you are referring to a table or figure. There are however packages that can determine this from the label. Have a look at prettyref.

A while ago I compiled a larger example for testing the package which first uses the standard referencing commands before using the prettyref commands in the end:



\newrefformat{lem}{Lemma \ref{#1}}
\newrefformat{thm}{Theorem \ref{#1}}
\newrefformat{cha}{Kapitel \ref{#1}}
\newrefformat{sec}{Abschnitt \ref{#1}}
\newrefformat{tab}{Tabelle \ref{#1} auf Seite \pageref{#1}}
\newrefformat{fig}{Abbildung \ref{#1} auf Seite \pageref{#1}}


\section{Erster Abschnitt}\label{sec:erst}


\caption{Hallo Welt!}%


\section{Zweiter Abschnitt}


\caption{Hallo Welt!}%


Siehe Abbildung \ref{fig:test1} auf Seite \pageref{fig:test1}

Siehe die Abbildung \vpageref{fig:test1}

Siehe Abbildung \vref{fig:test1}

Siehe Abbildung \ref{fig:test2} auf Seite \pageref{fig:test2}

Siehe Abbildung \vpageref{fig:test2}

Siehe Abbildung \vref{fig:test2}

Siehe Abbildungen \vrefrange{fig:test1}{fig:test2}

Siehe die Abbildungen \vpagerefrange{fig:test1}{fig:test2}



share|improve this answer
up vote 0 down vote accepted

The exact problem was traced to typos at my end. The answers provided here are helpful from their part, but my case was resolved by type correction.

share|improve this answer

Your Answer


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.