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

I am using the captionand subcaption package with floatrow and would like to change how references with \ref are formated.

First here is my captionsetup so far:


What I would like to achieve is the following (all for subfigures):

  1. the label should be \alph), e.g. a)
  2. a \subref{subfigureLabel} or \ref{subfigureLabel} should return basically the label: \alph), e.g. a)
  3. a \ref{compositeFigure} should return the prefix, the figurenumber, a space, followed by the label (including the brace), e.g. 'Figure 1.1 a)', (basically append the label of the subfigure with a space).

As you can see I solved (not quite satisfactory) 1. and 2., however I am struggling with three. First of I could not find anything like refformat, however there are good reasons for the existence of subrefformat. However I want to use \subref just for the short version (see 2.), so I can't use that. Furthermore I would like to know if there is an option to set the label and subref format with one command (I think it is reasonable and common to define them equally).

P.S.: I have seen http://tex.stackexchange.com/a/122306/19326, however it is a) for subfig and b) looks messier/more complicated than what I hope for but if that is what it takes...

share|improve this question
Maybe cleveref is worth a look. – Martin - マーチン Jul 29 '13 at 10:27
I am not sure yet. Note that I noticed two mistakes in my question and fixed them (I actually want to just ref and decide based on the label). The clevermanual states Cleveref does not modify the standard \ref or \pageref commands, so I am not sure it is the right tool for the job. I will give it a detailed look in the next day(s) and come back to this. – ted Jul 29 '13 at 11:00
You just use \cref instead of \ref. This command will the decide for you based on the label what it will typeset. However it will not typeset the ) brace, because this should be used as a delimiter only. If you really need the brace you should just simply redefine \thesubfigure – Martin - マーチン Jul 29 '13 at 13:06
up vote 3 down vote accepted

I am not sure if this is the desired result, but this was too long for a comment. The label format for subfigures is set to simple (just the counter with no parenthesis); \thesubfigure is redefined to include the parenthesis and then \p@subfigure (the prefix used when cross-referencing subfigures) is redefined to be the representation for the figure counter followed by a non-breakable space:





\chapter{Test chapter}

A reference to the figure:~\ref{fig:test}

A reference to the first subfigure:~\ref{sfig:testa}

A subreference to the first subfigure:~\subref{sfig:testa}

A reference to the second subfigure:~\ref{sfig:testb}

A subreference to the second subfigure:~\subref{sfig:testb}

\caption{a subfigure}
\caption{another subfigure}
\caption{a figure with two subfigures}


enter image description here

share|improve this answer
Much to my pleasure it works with floatrow as well. – ted Jul 29 '13 at 22:08
thank you! Is there a way to automatically turn off hyperref from linking \subref ? – Ciprian Tomoiaga Apr 26 at 16:01

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.