[Tex/LaTex] referencing several tables in one reference

cross-referencingtables

I need to reference several tables like Tables 1-3 or Tables 3.1 to 3.3 related with the section, I'm using the normal \ref{table1,table2,table3} to do what I want, but when I compile I get something like ??? Could someone tell me how to solve this little problem?

Best Answer

As already suggested in one of the comments, to achieve your objective you should load the cleveref package and type

\cref{table1,table2,table3}

Assuming these tables are numbered 1, 2, and 3, respectively, and assuming you're writing in English, you'll get

Tables 1--3

where "--" is supposed to represent an en-dash. (The conjuction particle is actually configurable; if one states \newcommand{\crefrangeconjunction}{ to~} in the preamble, one would get "Tables 1 to 3" instead of Tables 1--3.)

Note that you needn't actually enter the labels in consecutive order; if you'd written \cref{table2,table3,table1}, you'd still have gotten "Tables 1--3".

The package does impose an important restriction on the characters permitted in labels: since , is used as the separator between labels that form the the argument of \cref, you can't use , as a component of a label.