I am attempting to override \label so it will automatically create two labels.


When I look at the .aux file, there are two problems:

  1. \newlabel command does not contain "vol1".
  2. There is only one \newlabel per \label instead two.


Both answers were acceptable based on my original vague question. Accepted answer was able to interpret the complete question (as updated now).


2 Answers 2


Addition to egreg's answer:

\label is redefined by package nameref that is loaded by hyperref via \AtBeginDocument. Therefore it is enough to load nameref before redefining:



But the redefinition can additionally be put into \AtBeginDocument for the case there are other packages involved.

Also the questions talks about two labels, then additional stuff has to be done. \label tries to be invisible regarding spaces. If space is detected before it suppresses the following spaces. This mechanism does not work for consecutive \labels and the new definition should be surrounded by \@bsphack and \@esphack:


What is the purpose of the added vol1:? If the labels are used inside another document, then packages that are able to import foreign labels (xr, xr-hyper, zref-xr) usually allow the addition of a prefix for the label names. Assuming the main TeX file is called firstvolume.tex, then the other document uses something like:

xr/xr-hyper: \externaldocument[vol1:]{firstvolume}
zref-xr: \zxrsetup{...}\zexternaldocument*[vol1:]{firstvolumne}
  • Purpose was to allow a very large two part publication (many authors and editors) to be built by chapter, part, or the entire book and still have the references work. I am using xr for "standalone" building, thanks for the the other package suggestions.
    – h0tw1r3
    Sep 10, 2012 at 19:02
  • I think (?) there is a typo in the code here: presumably it should be \orig@label{#1}% \orig@label{vol1:#1}% Sep 28, 2022 at 1:06
  • @FreddieManners The first code block is an addition to egreg's example that only uses \orig@label{vol:#1}%. Sep 29, 2022 at 17:16
  • Sorry, I should have been more specific, my bad. In the second code block you have \renewcommand*{\label}[1]{ ... } and inside that command body you have \label{#1}\label{vol1:#1} but this appears to cause \label to enter an infinite loop. Changing the calls inside the body to \orig@label seemed to be what was intended. Sep 30, 2022 at 20:23
  • @FreddieManners Yes I see, thanks, answer fixed. Oct 1, 2022 at 13:53

I can reproduce the problem when hyperref is loaded, because it redefines \label.








The entry in the .aux file will be

  • 2
    Sometimes I wish I am having your marble. Sep 7, 2012 at 15:50
  • 6
    +1 Moral of the story: The OP should always supply a complete document that shows the problem (or rely on someone with a crystal ball:-) Sep 7, 2012 at 15:51
  • @DavidCarlisle point well taken!
    – h0tw1r3
    Sep 10, 2012 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .