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 reference labels in the sentence, as above in the code: like this - \ref{X,Y,Z} to give "Fig. 1a,1b,1c" or "Fig. 1a-c" in text.

\documentclass{article}

\usepackage{subfig}
\usepackage{cite}
\usepackage{hyperref}

\begin{document}    
...in the three statistically favoured models (Fig.~\ref{fig:LocalPoly1_residual,   
fig:IDW2_residual, fig:RBF_residual}) discussed below and not as well in the case of 
GlobalPoly5 (Fig.~\ref{fig:GlobalPoly5_residual}).

\begin{figure}[h!]
  \centering
  \subfloat[GlobalPoly5]{\label{fig:GlobalPoly5_residual}\includegraphics[width=0.25\textwidth]{"Data Analysis Files/GlobalPoly5_residual"}}                
  \subfloat[LocalPoly1]{\label{fig:LocalPoly1_residual}\includegraphics[width=0.25\textwidth]{"Data Analysis Files/LocalPoly1_residual"}}
  \subfloat[IDW2]{\label{fig:IDW2_residual}\includegraphics[width=0.25\textwidth]{"Data Analysis Files/IDW2_residual"}}
  \subfloat[RBF]{\label{fig:RBF_residual}\includegraphics[width=0.25\textwidth]{"Data Analysis Files/RBF_residual"}}
  \caption{Residual plots of each of the interpolators.}
  \label{fig:residualplot}
\end{figure}

\end{document}

@Leo Liu : it gives a lower case "f" for "figs." - do you know how make it uppercase "F" for consistency with my labelling elsewhere?

share|improve this question
    
This is not a good question. What do you want to "work"? Please explain what you want. –  Seamus Jun 14 '11 at 11:43
    
Sorry, I thought the title was sufficiently self-explanatory but perhaps I should be clearer. I want to reference labels in the sentence, as above in the code: like this - \ref{X,Y,Z}. –  ptrcao Jun 14 '11 at 11:47
    
I have to agree with @Seamus. The actual question should be stated in the body, not only in the title. "Reference multiple labels" can mean different things and the reader should not be forced to read the requested solution from the code! –  Martin Scharrer Jun 14 '11 at 11:58
    
Acknowledged, fixed. Let me know if anything else needs to be edited for clarity. Thanks. –  ptrcao Jun 14 '11 at 11:59
    
What exact output do you want? Something like "Fig. 1a,b,c"? –  Martin Scharrer Jun 14 '11 at 11:59

2 Answers 2

up vote 10 down vote accepted

Just use \cref or \Cref from cleveref package to reference multiple labels in one command.

For example, \cref{fig1,fig2,fig3} is valid. And use \Cref for capitals.

share|improve this answer
1  
I don't think you can have the space after the comma. (At least that didn't work when I just tested.) –  Torbjørn T. Jun 14 '11 at 12:04
    
@Torbjorn: Indeed. It seems that cleveref should be impoved. –  Leo Liu Jun 14 '11 at 12:23
    
@Leo Liu : see my OP for a refinement request –  ptrcao Jun 14 '11 at 12:24
1  
@ptrcao: Use \Cref. And you'd better read the package manual first for details. –  Leo Liu Jun 14 '11 at 12:27
1  
@Leo @ptrcao: \Cref is intended for the beginning of a sentence. To capitalize all refs, add the capitalize (or capitalise) option to the package, i.e. \usepackage[capitalize]{cleveref}. See the manual, section 5. –  Torbjørn T. Jun 14 '11 at 16:12

without package cleveref is must be \ref{..}\ref{...}

share|improve this answer

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.