Sign up ×
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 have a label that references what is currently section 1.4. Can I tweak either the \ref or \label so that it appears as 4 (i.e. only the subsection number) when reffed?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Assuming you're sure that your reference have the form m.n, then the following code

  \ifnum0=\temp ??\else

will do: call \subsecref{label}.

It's more complicated if the form of the references is different (say if they are chapter.section.subsection, but not conceptually more difficult.

A less efficient implementation that works also in expansion context is

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.