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 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).

share|improve this question
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. – Marco Daniel Sep 7 '12 at 15:41
If I try your redefinition and do \label{x}, I get \newlabel{vol1:x}{{1}{1}} in the aux file. – egreg Sep 7 '12 at 15:45
up vote 12 down vote accepted

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}
share|improve this answer
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 '12 at 19:02

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








The entry in the .aux file will be

share|improve this answer
Sometimes I wish I am having your marble. – Marco Daniel Sep 7 '12 at 15:50
+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:-) – David Carlisle Sep 7 '12 at 15:51
@DavidCarlisle point well taken! – h0tw1r3 Sep 10 '12 at 19:06

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.