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 am migrating from subfig to subcaption package and wondering how to make the following thing. The subcaption labels in floats should look like a single italic letter in brackets (a), and \subref{f:a} should give (a). At the same time, I would like \ref{f:a} to give me 1, a, i.e. \thefigure,~\thesubfigure. By default \ref{} gives 1a.

The code

\renewcommand*\subcaption@ref[2]{(\ref#1{sub@#2})}
\DeclareCaptionSubType[asbuk]{figure}
\renewcommand\thesubfigure{\textit{\asbuk{subfigure}}}

gives exactly what I want, except for the "comma and space" separator in \refs. Is there any macro in caption or subcaption package to redefine this separator?

share|improve this question
1  
Could you provide a minimal working example (MWE) for your code? That would make it easier for people to work on it and find solutions. –  Jake Aug 14 '11 at 3:19
add comment

1 Answer

You can redefine \p@subfigure. For an example code see Error using russian letters for appendix counter with hyperref and subfig

Addendum:

Please note that your method of patching the internal macro \subcaption@ref will not work with the upcoming version 1.1 of the subcaption package. See above link for patching \subref in a better way. (BTW: Version 1.1 will offer \captionsetup{subrefformat=parens} so patching is not needed anymore, furthermore the parenthesis will be part of the hyperlink then.)

share|improve this answer
    
Thanks, Axel. This example solved the problem. –  Stanislav Aug 14 '11 at 23:11
    
@Stanislav: I converted your "answer" to a comment. Note that answers are only for solution of the question. You couldn't add a comment because your first session expired and you then automatically created a new unregistered account (but which looks the same way). I merged the accounts now together. Please consider registering the account to avoid such things in the future. Please also accept Axel's answer by clicking the green tick symbol on the upper left side if this question solved your issue. –  Martin Scharrer Aug 15 '11 at 7:05
    
@Axel, it took me awhile to figure out what part of that answer you are referring to. Would you quote it? (\makeatletter ...) –  Justin Bailey Oct 3 '11 at 21:33
    
@Justin: This depends on what part of the question you are referring to. The extra parentheses will be setup by the option subrefformat=parens, the custom format of \ref will be setup by the redefinition of \p@subfigure. I think it's a good idea just to take one of the example codes and play around with it to see what change will have what effect. Please also take a look at the section "References" of the recent subcaption package documentation which gives additional examples. If you have any further questions please don't hesitate to ask. –  Axel Sommerfeldt Oct 4 '11 at 6:41
add comment

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.