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.

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 have the following code


    \part{First Part}
    \chapter{First Chapter}
    \label{inner} Some text.

    \part{Second Part}
    \chapter{First Chapter}

that produces a reference 1 for the label inner. How can I include the number of the part associated with the chapter in this reference, i.e. automatically create a cross-reference of the form I.1?

share|improve this question
up vote 5 down vote accepted

The LaTeX kernel provides a nifty mechanism for "prefixing" material to cross-references to counters. For every counter variable defined somewhere via a \newcounter macro named, say, somecounter, LaTeX automatically creates an auxilliary macro named \p@somecounter, and the value of this macro is automatically prefixed to the result of a \ref command that references the counter somecounter.

By default, these auxilliary prefixing macros are empty, but it's straightforward to modify them via \renewcommand instructions. For the case at hand, you could achieve your objective by adding the instructions

\renewcommand{\p@chapter}{\thepart.} % prefix "\thepart." to the number of the chapter

to the preamble, before loading hyperref. (The \makeatletter and \makeatother instructions are needed because the macro \p@chapter contains the character @ which normally has category code "other".)

share|improve this answer
Thank you for the detailed answer. – UniQP Apr 23 '14 at 8:58

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.