I invariably get warnings for undefined references/citations when running even the simplest pieces of code. I am running TeXworks (downloaded along with MiKTeX) on a Windows machine: MiKTeX-pdfTeX 4.3 (MiKTeX 21.1). Here is an MWE (main.tex):
\documentclass[12pt]{article}
\begin{document}
\section{Introduction} \label{sec:Intro}
This is the Introduction.
Section \ref{sec:sec2} is the second section. Section \ref{sec:sec3} is the third section.
\section{Second} \label{sec:sec2}
This is the second section. Here, we cite \cite{Goodwin}.
\section{Third} \label{sec:sec3}
This is the third section. Here, we cite \cite{TVG, Survey}.
\bibliographystyle{ieeetr}
\bibliography{refs}
\end{document}
My BiBTeX file is as follows (refs.bib):
@BOOK{Goodwin,
author = {Goodwin, G. C. and Sin, K. S.},
title = {Adaptive Filtering Prediction and Control},
publisher = {Dover Publications},
year = {1984}
}
@ARTICLE{TVG,
author = {Moore, K. L. and Chen, Y.-Q. and Bahl, V.},
title = {Monotonically convergent iterative learning control for linear discrete-time systems},
journal = {Automatica},
year = {2005},
volume = {41},
number = {9},
pages = {1529--1537}
}
@ARTICLE{Survey,
author = {Bristow, D. A. and Tharayil, M and Alleyne, A. G.},
title = {{A Survey of Iterative Learning Control}},
journal = {IEEE Control Systems Magazine},
year = {2006},
volume = {26},
number = {3},
pages = {96--114}
}
I get the following warnings when I typeset this with the option pdfLaTeX+MakeIndex+BibTeX in TeXworks (the refs.bib file is being run with the BibTeX option):
LaTeX Warning: Reference `sec:sec2' on page 1 undefined on input line 6.
LaTeX Warning: Reference `sec:sec3' on page 1 undefined on input line 6.
LaTeX Warning: Citation `Goodwin' on page 1 undefined on input line 9.
LaTeX Warning: Citation `TVG' on page 1 undefined on input line 12.
LaTeX Warning: Citation `Survey' on page 1 undefined on input line 12.
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
LaTeX Warning: Citation `Goodwin' on page 1 undefined on input line 9.
LaTeX Warning: Citation `TVG' on page 1 undefined on input line 12.
LaTeX Warning: Citation `Survey' on page 1 undefined on input line 12.
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
No .aux files are generated in the working folder.
Despite multiple re-runs of both main.tex and refs.bib, these warnings do not vanish. Surprisingly, the PDF renders perfectly, and there is no missing citation or cross-reference (i.e., no question mark in place of references/cross-references). When I try running main.tex with just the pdfLaTeX option, the warnings for cross-references vanish after running it twice, but warnings for citations remain:
LaTeX Warning: Citation `Goodwin' on page 1 undefined on input line 9.
LaTeX Warning: Citation `TVG' on page 1 undefined on input line 12.
LaTeX Warning: Citation `Survey' on page 1 undefined on input line 12.
LaTeX Warning: There were undefined references.
In this case, a .aux file is generated in the working folder.
I have tried changing the option for refs.bib to pdfLaTeX+MakeIndex+BibTeX, but it doesn't help. There is no simple LaTeX option for compilation.
I feel that this question is an extended version of this, but with TeXworks in my case, rather than TeXMaker. This problem has been annoying me for a while now, but I have found no suitable fix anywhere. Though the PDF renders properly, I would prefer not to get these warnings as the document simply takes much longer to compile.