X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeX.cpp;h=597efefb7cedecc5aa2d1f2754d76d06a860156f;hb=e1a685fcb1da65211e9eecd7ed3ac9daf7cd5f22;hp=f4d98155aad65f0bbcbbe0c628aa26f01e6e36f1;hpb=e1cabbf70e34a3d969327eaf5a9cbc4f8ee3e854;p=lyx.git diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index f4d98155aa..597efefb7c 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -29,12 +29,10 @@ #include "support/Systemcall.h" #include "support/os.h" -#include +#include "support/regex.h" #include -using boost::regex; -using boost::smatch; using namespace std; using namespace lyx::support; @@ -124,6 +122,10 @@ void LaTeX::deleteFilesOnError() const FileName const bbl(changeExtension(file.absFileName(), ".bbl")); bbl.removeFile(); + // biber file + FileName const bcf(changeExtension(file.absFileName(), ".bcf")); + bcf.removeFile(); + // makeindex file FileName const ind(changeExtension(file.absFileName(), ".ind")); ind.removeFile(); @@ -205,7 +207,8 @@ int LaTeX::run(TeXErrors & terr) LYXERR(Debug::DEPEND, "Dependency file has changed"); } - if (head.extchanged(".bib") || head.extchanged(".bst")) + if (head.extchanged(".bib") || head.extchanged(".bst") + || head.extchanged(".bcf")) run_bibtex = true; } else LYXERR(Debug::DEPEND, @@ -271,6 +274,12 @@ int LaTeX::run(TeXErrors & terr) if (head.haschanged(glofile)) rerun |= runMakeIndexNomencl(file, ".glo", ".gls"); + // check if we're using biber instead of bibtex + // biber writes no info to the aux file, so we just check + // if a bcf file exists (and, above, if it was updated) + FileName const bcffile(changeExtension(file.absFileName(), ".bcf")); + bool const biber = bcffile.exists(); + // run bibtex // if (scanres & UNDEF_CIT || scanres & RERUN || run_bibtex) if (scanres & UNDEF_CIT || run_bibtex) { @@ -281,7 +290,7 @@ int LaTeX::run(TeXErrors & terr) LYXERR(Debug::LATEX, "Running BibTeX."); message(_("Running BibTeX.")); updateBibtexDependencies(head, bibtex_info); - rerun |= runBibTeX(bibtex_info, runparams); + rerun |= runBibTeX(bibtex_info, runparams, biber); } else if (!had_depfile) { /// If we run pdflatex on the file after running latex on it, /// then we do not need to run bibtex, but we do need to @@ -333,7 +342,7 @@ int LaTeX::run(TeXErrors & terr) LYXERR(Debug::LATEX, "Running BibTeX."); message(_("Running BibTeX.")); updateBibtexDependencies(head, bibtex_info); - rerun |= runBibTeX(bibtex_info, runparams); + rerun |= runBibTeX(bibtex_info, runparams, biber); } // 4 @@ -560,12 +569,12 @@ void LaTeX::updateBibtexDependencies(DepTable & dep, bool LaTeX::runBibTeX(vector const & bibtex_info, - OutputParams const & runparams) + OutputParams const & runparams, bool biber) { bool result = false; for (vector::const_iterator it = bibtex_info.begin(); it != bibtex_info.end(); ++it) { - if (it->databases.empty()) + if (!biber && it->databases.empty()) continue; result = true; @@ -635,6 +644,10 @@ int LaTeX::scanLogFile(TeXErrors & terr) && contains(token, "undefined")) { retval |= ERROR_RERUN; LYXERR(Debug::LATEX, "Force rerun."); + // package etaremune + } else if (contains(token, "Etaremune labels have changed")) { + retval |= ERROR_RERUN; + LYXERR(Debug::LATEX, "Force rerun."); } else if (contains(token, "Citation") && contains(token, "on page") && contains(token, "undefined")) { @@ -653,6 +666,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) } else if (contains(token, "run BibTeX")) { retval |= UNDEF_CIT; } else if (contains(token, "Rerun LaTeX") || + contains(token, "Please rerun LaTeX") || contains(token, "Rerun to get")) { // at least longtable.sty and bibtopic.sty // might use this. @@ -952,7 +966,7 @@ void LaTeX::deplog(DepTable & head) string lastline; while (ifs) { // Ok, the scanning of files here is not sufficient. - // Sometimes files are named by "File: xxx" only + // Sometimes files are named by "File:� xxx" only // So I think we should use some regexps to find files instead. // Note: all file names and paths might contains spaces. bool found_file = false; @@ -1009,7 +1023,7 @@ void LaTeX::deplog(DepTable & head) // However, ... if (suffixIs(token, ")")) // no line break for sure - // pretend we've been succesfully searching + // pretend we've been successfully searching found_file = true; // (2) "No file file.ext" } else if (regex_match(token, sub, reg2)) { @@ -1050,7 +1064,7 @@ void LaTeX::deplog(DepTable & head) file.absFileName(), ".toc")), head); else // not found, but we won't check further - // pretend we've been succesfully searching + // pretend we've been successfully searching found_file = true; // (8) "(file.ext" @@ -1089,7 +1103,7 @@ void LaTeX::deplog(DepTable & head) // we have a closing bracket, so the content // is not a file name. // no need to investigate further - // pretend we've been succesfully searching + // pretend we've been successfully searching first = what[0].second; found_file = true; }