Index: trunk/doc/release.2015/Makefile.Common
===================================================================
--- trunk/doc/release.2015/Makefile.Common	(revision 39974)
+++ trunk/doc/release.2015/Makefile.Common	(revision 40022)
@@ -14,12 +14,11 @@
 
 %.pdf: %.tex
-	$(MY_LATEX) $*.tex
-
-#	$(MY_LATEX) $*.tex; if [ $? -eq 1 ]; then rm $*.pdf; exit 1; fi
-
-junk:
-	if [ $(DO_BIBTEX) -eq 1 ]; then $(BIBTEX) $*; fi
-	$(MY_LATEX) $*.tex; if [ $? -eq 1 ]; then rm $*.pdf; exit 1; fi
-	if [ $(DO_BIBTEX) -eq 1  ]; then $(MY_LATEX) $*.tex; fi
+# 	need to remove the output pdf file if the latex fails or we cannot re-run
+	$(MY_LATEX) $*.tex || (rm $*.pdf; exit 1)
+	if [ $(DO_BIBTEX) -eq 1 ]; then $(BIBTEX) $* || (echo fail; exit 1); fi
+# 	need to re-run latex to get the reference right
+	$(MY_LATEX) $*.tex || (rm $*.pdf; exit 1)
+# 	if we are running bibtex, we need to re-run latex AGAIN to get the reference right
+	if [ $(DO_BIBTEX) -eq 1  ]; then $(MY_LATEX) $*.tex || (rm $*.pdf; exit 1); fi
 #	thumbpdf --modes=dvips $*.pdf
 #	$(MY_LATEX) $*.tex 
