Bug 157787 - "undefined reference" but the reference is defined
"undefined reference" but the reference is defined
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: tetex (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Jindrich Novy
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-15 11:55 EDT by John Smith
Modified: 2013-07-02 19:07 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-19 12:06:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
foo.tex (4.97 KB, text/plain)
2005-05-15 11:55 EDT, John Smith
no flags Details
source file with a chapter (5.00 KB, text/plain)
2005-05-16 04:40 EDT, John Smith
no flags Details

  None (edit)
Description John Smith 2005-05-15 11:55:18 EDT
Description of problem:

When I compile the attached file, I get the following error:

Reference `FOOBAR' on page 7 undefined on input line 69.

I have used the identifier `foobar' to define a label and
to refer to it, but I haven't used the identifier `FOOBAR`
anywhere in the source file.

Version-Release number of selected component (if applicable):
tetex-3.0-4

How reproducible:
Always, on my machine.  Well, the phenomenom seems to be very
dependent on the layout, and I do not know to what extent the
layout is controlled by parameters in configuration files,
outside of the source file (like papersize etc.).  If it doesn't
work for you, try adding a few lines of foo \bigskip foo ...

Steps to Reproduce:

1. Replace put_your_language_here in the source file with your
language.  [That's something I haven't elucidated yet: if I
don't put the \usepackage[...]{babel} line in the source file
or if I specify another language than mine, latex refuses to
compile the file.]

2. Type: latex foo.tex
  
Actual results:
LaTeX Warning: Reference `FOOBAR' on page 7 undefined on input line 69.

Expected results:
Compile cleanly.
Comment 1 John Smith 2005-05-15 11:55:19 EDT
Created attachment 114395 [details]
foo.tex
Comment 2 Jindrich Novy 2005-05-16 02:53:54 EDT
The problem is that LaTeX actually doesn't know how to refer to the label I see
from the source you attached. \label has to be used only within some block that
have some reference number, \section, \chapter, \begin{table} etc. Note that you
defined your \label at the top level that has no reference number so LaTeX has
no clue how to name the reference.

It behaves as it should that it refuses to create a reference.
Comment 3 John Smith 2005-05-16 04:40:21 EDT
Created attachment 114415 [details]
source file with a chapter
Comment 4 John Smith 2005-05-16 04:42:03 EDT
I have just added the line

\chapter{Here's a chapter}

before the label definition.  The bug still happens.
Comment 5 Jindrich Novy 2005-05-16 05:07:04 EDT
You need to pass the source through LaTeX twice in order to get correct
references. It's also quite unusual that you refer to a chapter from a section
header. Please refer to it from somewhere inside a section body, i.e.

\section{And now for something completely different}
This is a reference to chapter \ref{foobar}.

and you'll see no warnings about invalid references.

Comment 6 John Smith 2005-05-16 06:03:31 EDT
I know latex has to be run twice.  What I claim is that even if it is
run twice, it finds an undefined reference, which is a bug.

Indeed I could work around the bug by not referring to the label
inside the section body.  But I do want to do this and it *is* valid
LaTeX.  I have been doing it for years and I still want to do it now.

If you remove all (or most of) the lines of foo \bigskip foo,
then suddenly latex does not complain any more, which clearly
is inconsistent.

When I report a bug I'm not asking for advice as to how to work around it.
Please have a serious look at this issue. Thanks in advance.
Comment 7 Jindrich Novy 2005-05-16 06:53:33 EDT
Ok, maybe some regression was introduced by LaTeX within teTeX-3.0.
The warning message seems to be a minor inconsistency. Because pdfLaTeX doesn't 
refuse to generate a valid pdf, changing severity/priority to low.

The best solution here is to report the problem upstream. I don't have a deep
knowledge of LaTeX code and can't spend hours finding a fix for warning message,
sorry. Could you please report this problem upstream? The upstream developers
have a good insight into LaTeX code and respond quickly. Furthermore a fix for
this issue will affect all the distributions, not only Fedora, when a it's
applied upstream.

Please read first:
http://www.latex-project.org/bugs.html

and then file the bug in:
http://www.latex-project.org/bugs-upload.html

Could you then add here a reference to the bug you reported so that I can track
it to have a patch to fix this applied?
Comment 8 John Smith 2005-05-19 11:59:31 EDT
Done: babel/3786

It turns out to be a known bug in babel for which "a fix may be difficult if not
impossible in the current implementation".
Comment 9 Jindrich Novy 2005-05-19 12:06:39 EDT
Thanks for filing the bug in upstream and posting here a reference to it.
Did you have any other fruitful feedback from the upstream developers that the
fix for this is hopeless for the current implementation?
Comment 10 John Smith 2005-05-20 05:39:40 EDT
I haven't had other feedback than what can be read in their bug database, i.e.
what I mentioned already and the following workaround:

\section{And now for something completely different: \MakeLowerCase{\ref{foobar}}}

Of course it does not work anymore if the label contains an uppercase letter.
I suggest another workaround: put two labels instead of just one, like this:
\label{foobar}
\label{FOOBAR}

Note You need to log in before you can comment on or make changes to this bug.