]> git.lyx.org Git - features.git/commitdiff
Properly resolve undefined citations with Xe/Lua and bibliography environment
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 8 Apr 2023 17:25:30 +0000 (19:25 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 8 Apr 2023 17:25:30 +0000 (19:25 +0200)
These need an extra LaTeX run

src/LaTeX.cpp

index 917d129424613286280d9ee64061b6bcf40aa2b6..7d9810aef1a8b22e147c8d571191ec98145ae693 100644 (file)
@@ -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.