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

This issue actually frustrates me for a while, but prior for finding the solution, I would like to know why this happens. In a nutshell: My TeXStudio does recognise ALL my \label, but the output does not recognise some labels.


I am writing my notes on Physics, however, sometimes I got warnings of:

LaTeX Warning: Reference `eq:pointcd' on page 196 undefined on input line 985.

This is just for example, I have other examples in the document that does not have \label recognised. There are also some weird situation where I have the same format of putting \label, but got recognised by the compiler.


% ------------here comes the problem part------------
%======================== Ch.4 boxes =========================

\newtcolorbox[auto counter,number within=chapter,list inside=eg]%
title={Exercise ~\thetcbcounter: #2}}

% theorem 
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2 \theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ \sffamily{##3}  \theorem@separator]}
% ------------here ends the problem part------------
\rho\left(\mathbf{r}\right)\;=\;\sum_{k=1}^{N}\: q_k \delta\left(\mathbf{r}\;-\;\mathbf{r}_k\right)
However, one should alert for the unphysical divergence in other quantities associated with \eqref{eq:pointcd}.

In your answer...

I am not specifying you of how to answer this question, this section is just my suspects on the issue. For example,

  1. The pdf compiler is faulty? (I use Acrobat XI and with PdfLaTeX as compiler and using DVI -> PS -> PDF chain in TeXStudio)
  2. My compiling procedures has done wrongly?
  3. My format is done wrong (although I fairly think so because I changed my format according to many sources but no luck).
  4. TeXStudio is faulty? (Just a suspect, but did happened with other IDEs before and I am using ver. 2.8.0)
  5. I haven't read the manual carefully? (smile)

It turns out some code has obstructed the PdfLaTeX to recognise some \label.


While I was omitting the parts that I have some idea why it happens, however, it is neither of the five above.

  1. While I deleted some of the \frontmatter, by delete a section (see MWE above) become fine to recognise the referencing.
  2. I suspect the part is obstructing the compiler to recognise some \label.


See Mico's answer, but I would like to append that it was actually because of

5. I haven't read the manual carefully
share|improve this question
Do you run pdflatex twice on your document? – Christian Hupfer Aug 24 '14 at 9:00
Just out of curiosity: Since you have pdflatex, why don't you compile directly from tex to pdf? Put differently, why use the old, roundabout way via dvi and ps? – Mico Aug 24 '14 at 9:01
@SHY.John If you want help with a document where the cross references do not resolve, make an example of that problem not an example of a perfectly standard document that behaves as expected. – David Carlisle Aug 24 '14 at 9:16
No, it's better if you make an example small enough to post here, start with a copy of your original document and delete everything you can delete while still demonstrating th eproblem – David Carlisle Aug 24 '14 at 9:19
I do not believe this question should have been closed as a duplicate -- the linked posting certainly doesn't provide answers to what went wrong in this question. For the sake of completeness: The OP was experiencing problems because he/she had failed to specify an option when loading the package ntheorem, rather than for any of the reasons discussed in the posting that this is supposed to be a duplicate of. – Mico Aug 24 '14 at 13:02
up vote 11 down vote accepted

Thanks for posting some code that produces the problem behavior you're looking to solve.

The problematic statement in your preamble turns out to be


and, more specifically, the option thmmarks. Remove this option, and the cross-referencing problem goes away.

Alternatively, since you load the amsmath package as well, simply add the option amsmath and the thmmarks option doesn't cause problems either. (Incidentally, this fix is mentioned explicitly in section 3.2.1 of the user guide of the ntheorem package.)

share|improve this answer
One can also add the option amsmath, see 3.2. in the documentation of ntheorem. – Ulrike Fischer Aug 24 '14 at 10:17
@UlrikeFischer - thanks. I've added this observation to my answer. :-) – Mico Aug 24 '14 at 10:17
+1 you just beat me to it:-) – David Carlisle Aug 24 '14 at 10:19
I was thinking to add a thmmarks at the end of theorems but ended up on changing the font of theorems instead. So the option become useless. When I omit the option, it recovered from conflict and no other aftermaths. You are going to receive a "tick" instead of a "thank you", sorry. – SHY.John Aug 24 '14 at 10:21
@DavidCarlisle Although you did not get a "tick", you taught me that experiment first rather just throw out a MWE is a good practice. Thank you. – SHY.John Aug 24 '14 at 10:24

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.