[LyX/master] Properly resolve undefined citations with Xe/Lua and bibliography environment

Juergen Spitzmueller spitz at lyx.org
Sat Apr 8 16:20:52 UTC 2023


commit 7b6707fc52e6b87230cf773106fdc31d93beb4c0
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Apr 8 19:25:30 2023 +0200

    Properly resolve undefined citations with Xe/Lua and bibliography environment
    
    These need an extra LaTeX run
---
 src/LaTeX.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 917d129..7d9810a 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -401,11 +401,13 @@ int LaTeX::run(TeXErrors & terr)
 	// After the bibliography was processed, we need more passes of LaTeX
 	// in order to resolve the citations. We need to do this before the index
 	// is being generated (since we need the correct pagination, see #2696).
+	// With bibliography environment, another LaTeX run might be needed
+	// as well to resolve citations.
 	// Also, memoir (at least) writes an empty *idx file in the first place.
 	// A further latex run is needed in that case as well.
 	FileName const idxfile(changeExtension(file.absFileName(), ".idx"));
-	if (run_bibtex || (idxfile.exists() && idxfile.isFileEmpty())) {
-		while ((head.sumchange() || rerun || (scanres & RERUN))
+	if (run_bibtex || (scanres & UNDEF_CIT) || (idxfile.exists() && idxfile.isFileEmpty())) {
+		while ((head.sumchange() || rerun || (scanres & RERUN) || (scanres & UNDEF_CIT))
 		       && count < MAX_RUN) {
 			// Yes rerun until message goes away, or until
 			// MAX_RUNS are reached.


More information about the lyx-cvs mailing list