Subject: bug#24771: 11.89.6; C-c C-c misses one LaTeX run in BibTeX documents

From: Mosè Giordano <[email-masked]>
Date: Sun, 23 Oct 2016 11:58:34 +0200

Hi Uwe,

2016-10-23 11:17 GMT+02:00 Uwe Siart <[email-masked]>:
> By trying to generate the MWE I think I found the culprit. Perhaps
> nothing to do with 11.89.6 but could have happend before as well.
>
> The described behaviour is observed when there are multiply defined
> labels.
>
> When I compile the following MWE by "C-c C-a" it ends up with undefined
> references (one LaTeX run too few):
>
> \documentclass{article}
> \begin{filecontents}{test-a.bib}
> @Article{reed:1958:398,
> author       = {Reed, John},
> title        = {The Multiple Branch Waveguide Coupler},
> journal      = {IRE Trans. Microw. Theory Techn.},
> year         = {1958},
> volume       = {6},
> number       = {4},
> pages        = {398--403},
> month        = {Apr},
> }
> \end{filecontents}
> \begin{document}
> Test \cite{reed:1958:398}
> \begin{figure}
>   \caption{Caption A}
>   \label{fig:A}
> \end{figure}
> \begin{figure}
>   \caption{Caption B}
>   \label{fig:A}
> \end{figure}
> \bibliographystyle{plain}
> \bibliography{test-a}
> \end{document}

Thanks for the MWE.  Indeed, it has nothing to do with the BibTeX
sentinel but with the LaTeX one.  The problems pops up only when there
is a BibTeX bibliography by chance.

Your document produces two relevant warnings:

    LaTeX Warning: Label `fig:A' multiply defined.
    LaTeX Warning: Citation `reed:1958:398' on page 1 undefined on
input line 15.

but `TeX-LaTeX-sentinel' knows only about the second one.  When it
finds it, it suggests to directly open the viewer.  The problem here
is that LaTeX does not help AUCTeX to decide the right thing to do.
If there weren't the multiple label (or no label at all), there will
be also the warning

    LaTeX Warning: Label(s) may have changed. Rerun to get
cross-references right.

that in this case is missing.  I would say that AUCTeX is doing the
right thing given the information it has.

This is a corner case that I don't know how to deal with.  Do you or
someone else have suggestion about what's the best solution?

Bye,
Mosè