home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / src / LaTeX.C < prev    next >
C/C++ Source or Header  |  1998-04-23  |  18KB  |  674 lines

  1. /* This file is part of
  2.  * ======================================================
  3.  * 
  4.  *           LyX, The Document Processor      
  5.  *         Copyright (C) 1995 Matthias Ettrich
  6.  *           Copyright (C) 1995-1998 The LyX Team.
  7.  *
  8.  *           This file is Copyright (C) 1996-1998
  9.  *           Lars Gullik Bj°nnes
  10.  *
  11.  *======================================================
  12.  */
  13.  
  14. #include <config.h>
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18.  
  19. #ifdef __GNUG__
  20. #pragma implementation
  21. #endif
  22.  
  23. #include "filetools.h"
  24. #include "LaTeX.h"
  25. #include "lyxlex.h"
  26. #include "FileInfo.h"
  27. #include "error.h"
  28. #include "lyxlib.h"
  29. #include "syscall.h"
  30. #include "syscontr.h"
  31. #include "path.h"
  32. #include "bufferlist.h"
  33. #include "minibuffer.h"
  34. #include "gettext.h"
  35.  
  36. //     $Id: LaTeX.C,v 1.1.1.1 1998/04/23 16:02:47 larsbj Exp $    
  37.  
  38. #if !defined(lint) && !defined(WITH_WARNINGS)
  39. static char vcid[] = "$Id: LaTeX.C,v 1.1.1.1 1998/04/23 16:02:47 larsbj Exp $";
  40. #endif /* lint */
  41.  
  42. extern BufferList bufferlist;
  43.  
  44. struct texfile_struct {
  45.     LaTeX::TEX_FILES file;
  46.     char const *extension;
  47. };
  48.  
  49. static
  50. const texfile_struct all_files[] = {
  51.     { LaTeX::AUX, ".aux"},
  52.     { LaTeX::BBL, ".bbl"},
  53.     { LaTeX::DVI, ".dvi"},
  54.     { LaTeX::GLO, ".glo"},
  55.     { LaTeX::IDX, ".idx"},
  56.     { LaTeX::IND, ".ind"},
  57.     { LaTeX::LOF, ".lof"},
  58.     { LaTeX::LOA, ".loa"},
  59.     { LaTeX::LOG, ".log"},
  60.     { LaTeX::LOT, ".lot"},
  61.     { LaTeX::TOC, ".toc"},
  62.     { LaTeX::LTX, ".ltx"},
  63.     { LaTeX::TEX, ".tex"}
  64. };
  65.  
  66. // This should perhaps be placed in LyXLex
  67. static
  68. LString readLine(FILE *file)
  69. {
  70.     if (feof(file))
  71.         return LString();
  72.  
  73.     int i = 0;
  74.     char s[512];
  75.  
  76.     do {
  77.         s[i] = fgetc(file);
  78.         i++;
  79.     } while (!feof(file) && s[i-1] != '\n' && i<510);
  80.     s[i] = '\0';
  81.     LString tmp;
  82.     if (i == 1 && feof(file))
  83.         ;
  84.     else
  85.         tmp = s;
  86.  
  87.     return tmp;
  88. }
  89.  
  90.  
  91.  
  92. /*
  93.  * CLASS TEXERRORS
  94.  */
  95.  
  96. // I did not leave this inlined because DEC cxx does not like
  97. // variables declarations in inlined code (JMarc)
  98. TeXErrors::~TeXErrors()
  99. {
  100.     Error *tmp;
  101.     while (errors) {
  102.         tmp = errors->next_error;
  103.         delete errors;
  104.         errors = tmp;
  105.     }
  106. }
  107.  
  108. void TeXErrors::scanError(LyXLex &lex)
  109. {
  110.     LString token = lex.GetString();
  111.     // Sometimes the error string goes over more than one
  112.     // line, and we need to get them all.
  113.     LString tmp;
  114.     LString errstr;
  115.     tmp = readLine(lex.getFile()).frontStrip();
  116.     if (tmp == "\n" || tmp.empty()) {
  117.         tmp = readLine(lex.getFile()).frontStrip();
  118.         if (tmp.contains("See the LaTeX manual")) {
  119.             do {
  120.                 tmp = readLine(lex.getFile());
  121.             } while (!tmp.empty() && !tmp.contains("..."));
  122.         }
  123.         tmp = readLine(lex.getFile()).frontStrip();
  124.     }
  125.  
  126.     while ((tmp != "\n" || !errstr.contains("l."))
  127.         && !tmp.prefixIs("! ")
  128.         && !tmp.contains("(job aborted")
  129.         && !tmp.empty()) {
  130.         errstr += tmp;
  131.         tmp = readLine(lex.getFile()).frontStrip();
  132.     }
  133.     lyxerr.debug("tmp: " + errstr);
  134.     int line = 0;
  135.     // unfortunately the error line is not always given
  136.     // by "l.###" in the beginning of the error string
  137.     // therefore we must search for "l.###" in the error
  138.     // msg.
  139.     if (errstr.contains("l.")) {
  140.         // We make a const copy to make [] fast. (Asger)
  141.         LString const es = errstr;
  142.         for (int i = 2; i < es.length(); i++) {
  143.             if (es[i-2] == 'l' && es[i-1] == '.' &&
  144.                 (es[i] >= '0' && es[i]<= '9')) {
  145.                 line = atoi(es.c_str() + i);
  146.                 break;
  147.             }
  148.         }
  149.     }
  150.     insertError(line, token, errstr);
  151.  
  152.     if (tmp.prefixIs("! ")) {
  153.         scanError(lex);
  154.     }
  155. }
  156.  
  157.  
  158. bool TeXErrors::getFirstError(int *line, LString *text)
  159. {
  160.         next_error = errors;
  161.         if (next_error) {
  162.                 *line = next_error->error_in_line;
  163.                 *text = next_error->error_desc + "\n" + next_error->error_text;
  164.                 next_error = next_error->next_error;
  165.                 return true;
  166.         }
  167.         return false;
  168. }
  169.  
  170.  
  171. bool TeXErrors::getNextError(int *line, LString *text)
  172. {
  173.         if (next_error) {
  174.                 *line = next_error->error_in_line;
  175.                 *text = next_error->error_desc + "\n" + next_error->error_text;
  176.                 next_error = next_error->next_error;
  177.                 return true;
  178.         }
  179.         return false;
  180. }
  181.  
  182.  
  183. void TeXErrors::insertError(int line, LString const &error_desc,
  184.                 LString const &error_text)
  185. {
  186.         Error *newerr = new Error(line, error_desc, error_text);
  187.         if (errors) {
  188.                 Error *tmperr = errors;
  189.                 while (tmperr->next_error) tmperr = tmperr->next_error;
  190.                 tmperr->next_error = newerr;
  191.         } else {
  192.                 errors = newerr;
  193.         }
  194. }
  195.  
  196.  
  197. void TeXErrors::printErrors()
  198. {
  199.         lyxerr.print("Printing errors.");
  200.         if (errors) {
  201.                 Error *tmperr = errors;
  202.                 do {
  203.                         lyxerr.print(LString("Error in line ")
  204.                      + tmperr->error_in_line
  205.                      + ": " + tmperr->error_desc
  206.                      + '\n' + tmperr->error_text);
  207.             //%d: %s\n%s\n", tmperr->error_in_line,
  208.             //     tmperr->error_desc.c_str(),
  209.             //     tmperr->error_text.c_str());
  210.                         tmperr = tmperr->next_error;
  211.                 } while (tmperr);
  212.         }
  213. }
  214.  
  215.  
  216. void TeXErrors::printWarnings()
  217. {
  218. }
  219.  
  220.  
  221. void TeXErrors::printStatus()
  222. {
  223.         printf("Error struct:\n");
  224.         printf("\t status: %d\n", status);
  225.         printf("\t no err: %d\n", number_of_errors);
  226.         if (status == LaTeX::NO_ERRORS) printf("NO_ERRORS\n");
  227.         if (status & LaTeX::NO_LOGFILE) printf("NO_LOGFILE\n");
  228.         if (status & LaTeX::NO_OUTPUT) printf("NO_OUTPUT\n");
  229.         if (status & LaTeX::UNDEF_REF) printf("UNDEF_REF\n");
  230.         if (status & LaTeX::RERUN) printf("RERUN\n");
  231.         if (status & LaTeX::TEX_ERROR) printf("TEX_ERROR\n");
  232.         if (status & LaTeX::TEX_WARNING) printf("TEX_WARNING\n");
  233.         if (status & LaTeX::NO_FILE) printf("NO_FILE\n");
  234. }
  235.  
  236.  
  237. /*
  238.  * CLASS LaTeX
  239.  */
  240.  
  241. LaTeX::LaTeX(LString const & latex, LString const & f, LString const & p)
  242.         : cmd(latex), file(f), path(p)
  243. {
  244.     tex_files = NO_FILES;
  245.     file_count = sizeof(all_files) / sizeof(texfile_struct);
  246.     num_errors = 0;
  247.     depfile = file + ".dep";
  248. }
  249.  
  250.  
  251. int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
  252.     // We know that this function will only be run if the lyx buffer
  253.     // has been changed. We also know that a newly written .tex file
  254.     // is always different from the previous one because of the date
  255.     // in it. However it seems safe to run latex (at least) on time each
  256.     // time the .tex file changes.
  257. {
  258.     int scanres = LaTeX::NO_ERRORS;
  259.     unsigned int count = 0; // number of times run
  260.     num_errors = 0; // just to make sure.
  261.     const int MAX_RUN = 6;
  262.     DepTable head; // empty head
  263.     bool rerun = false; // rerun requested
  264.     
  265.     // The class LaTeX does not know the temp path.
  266.     bufferlist.updateIncludedTeXfiles(GetCWD());
  267.     
  268.     // Never write the depfile if an error was encountered.
  269.     
  270.     // 0
  271.     // first check if the file dependencies exist:
  272.     //     ->If it does exist
  273.     //             check if any of the files mentioned in it have
  274.     //             changed (done using a checksum).
  275.     //                 -> if changed:
  276.     //                        run latex once and
  277.     //                        remake the dependency file
  278.     //                 -> if not changed:
  279.     //                        just return there is nothing to do for us.
  280.     //     ->if it doesn't exist
  281.     //             make it and
  282.     //             run latex once (we need to run latex once anyway) and
  283.     //             remake the dependency file.
  284.     //
  285.     FileInfo fi(depfile);
  286.     if (fi.exist()) {
  287.         // Read the dep file:
  288.         head.read(depfile);
  289.         // Update the checksums
  290.         head.update();
  291.         
  292.         lyxerr.debug("Dependency file exists", Error::LATEX);
  293.         if (head.sumchange()) {
  294.             lyxerr.debug("Dependency file has changed", 
  295.                      Error::LATEX);
  296.             lyxerr.debug(LString(_("Run #")) + int(++count), 
  297.                      Error::LATEX);
  298.             minib->Set(LString(_("LaTeX run number ")) + int(count));
  299.             minib->Store();
  300.             this->operator()();
  301.             scanres = scanLogFile(terr);
  302.             if (scanres & LaTeX::ERRORS) return scanres; // return on error
  303.         } else {
  304.             lyxerr.debug("return no_change", Error::LATEX);
  305.             return LaTeX::NO_CHANGE;
  306.         }
  307.     } else {
  308.         lyxerr.debug("Dependency file does not exist",
  309.                  Error::LATEX);
  310.         lyxerr.debug(LString(_("Run #")) + int(++count),
  311.                  Error::LATEX); 
  312.         deptex(head);
  313.         head.update();
  314.         minib->Set(LString(_("LaTeX run number ")) + int(count));
  315.         minib->Store();
  316.         this->operator()();
  317.         scanres = scanLogFile(terr);
  318.         if (scanres & LaTeX::ERRORS) return scanres; // return on error
  319.     }
  320.  
  321.     // update the dependencies.
  322.     deplog(head); // reads the latex log
  323.     deptex(head); // checks for latex files
  324.     head.update();
  325.  
  326.     // 0.5
  327.     // At this point we must run external programs if needed.
  328.     // makeindex will be run if a .idx file changed or was generated.
  329.     // And if there were undefined citations or changes in references
  330.     // the .aux file is checked for signs of bibtex. Bibtex is then run
  331.     // if needed.
  332.     
  333.     // run makeindex
  334.     if (head.haschanged(ChangeExtension(file, ".idx", true))) {
  335.         // no checks for now
  336.         minib->Set(_("Running MakeIndex."));
  337.         minib->Store();
  338.         rerun=runMakeIndex(ChangeExtension(file,".idx",true));
  339.     }
  340.  
  341.     // run bibtex
  342.     if (scanres & LaTeX::UNDEF_CIT || scanres & LaTeX::RERUN) {
  343.         // Here we must scan the .aux file and look for
  344.         // "\bibdata" and/or "\bibstyle". If one of those
  345.         // tags is found -> run bibtex and set rerun = true;
  346.         // no checks for now
  347.         minib->Set(_("Running BibTeX."));
  348.         minib->Store();
  349.         rerun = runBibTeX(ChangeExtension(file, ".aux", true));
  350.     }
  351.     
  352.     // 1
  353.     // we know on this point that latex has been run once (or we just
  354.     // returned) and the question now is to decide if we need to run
  355.     // it any more. This is done by asking if any of the files in the
  356.     // dependency file has changed. (remember that the checksum for
  357.     // a given file is reported to have changed if it just was created)
  358.     //     -> if changed or rerun == true:
  359.     //             run latex once more and
  360.     //             update the dependency structure
  361.     //     -> if not changed:
  362.     //             we does nothing at this point
  363.     //
  364.     if (rerun || head.sumchange()) {
  365.         rerun = false;
  366.         lyxerr.debug("Dep. file has changed or rerun requested", 
  367.                  Error::LATEX);
  368.         lyxerr.debug(LString("Run #") + int(++count),
  369.                  Error::LATEX);
  370.         minib->Set(LString(_("LaTeX run number ")) + int(count));
  371.         minib->Store();
  372.         this->operator()();
  373.         scanres = scanLogFile(terr);
  374.         if (scanres & LaTeX::ERRORS) return scanres; // return on error
  375.         // update the depedencies
  376.         deplog(head); // reads the latex log
  377.         head.update();
  378.     } else {
  379.         lyxerr.debug("Dep. file has NOT changed", Error::LATEX);
  380.     }
  381.  
  382.     // 1.5
  383.     // The inclusion of files generated by external programs like
  384.     // makeindex or bibtex might have done changes to pagenumbereing,
  385.     // etc. And because of this we must run the external programs
  386.     // again to make sure everything is redone correctly.
  387.     // Also there should be no need to run the external programs any
  388.     // more after this.
  389.     
  390.     // run makeindex if the <file>.idx has changed or was generated.
  391.     if (head.haschanged(ChangeExtension(file, ".idx", true))) {
  392.         // no checks for now
  393.         minib->Set(_("Running MakeIndex."));
  394.         minib->Store();
  395.         rerun = runMakeIndex(ChangeExtension(file, ".idx", true));
  396.     }
  397.     
  398.     // 2
  399.     // we will only run latex more if the log file asks for it.
  400.     //     -> rerun asked for:
  401.     //             run latex and
  402.     //             remake the dependency file
  403.     //             goto 2 or return if max runs are reached.
  404.     //     -> rerun not asked for:
  405.     //             just return (fall out of bottom of func)
  406.     //
  407.     while ((rerun || (scanres & LaTeX::RERUN)) && count < MAX_RUN) {
  408.         // Yes rerun until message goes away, or until
  409.         // MAX_RUNS are reached.
  410.         rerun = false;
  411.         lyxerr.debug(LString(_("Run #")) + int(++count), Error::LATEX);
  412.         minib->Set(LString(_("LaTeX run number ")) + int(count));
  413.         minib->Store();
  414.         this->operator()();
  415.         scanres = scanLogFile(terr);
  416.         if (scanres & LaTeX::ERRORS) return scanres; // return on error
  417.         // keep this updated
  418.         head.update();
  419.     }
  420.  
  421.     // Write the dependencies to file.
  422.     head.write(depfile);
  423.     lyxerr.debug("Done.", Error::LATEX);
  424.     return scanres;
  425. }
  426.  
  427.  
  428. int LaTeX::operator()()
  429. {
  430. #ifndef __EMX__
  431.     LString tmp = cmd + ' ' + file + " > /dev/null";
  432. #else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null"
  433.     LString tmp = cmd + ' ' + file + " > nul";
  434. #endif
  435.         Systemcalls one;
  436.     return one.Startscript(Systemcalls::System, tmp);
  437. }
  438.  
  439.  
  440. bool LaTeX::runMakeIndex(LString const &file)
  441. {
  442.     lyxerr.debug("idx file has been made,"
  443.               " running makeindex on file "
  444.               + file, Error::LATEX);
  445.  
  446.     // It should be possible to set the switches for makeindex
  447.     // sorting style and such. It would also be very convenient
  448.     // to be able to make style files from within LyX. This has
  449.     // to come for a later time. (0.13 perhaps?)
  450.     LString tmp = "makeindex -c -q ";
  451.     tmp += file;
  452.     Systemcalls one;
  453.     one.Startscript(Systemcalls::System, tmp);
  454.     return true;
  455. }
  456.  
  457.  
  458. bool LaTeX::runBibTeX(LString const &file)
  459. {
  460.     LyXLex lex(NULL, 0);
  461.     LString token;
  462.     if (!lex.setFile(file)) {
  463.         // unable to open .aux file
  464.         // return at once
  465.         return false;
  466.     }
  467.  
  468.     while (lex.IsOK()) {
  469.         if (lex.EatLine())
  470.             token=lex.GetString();
  471.         else // blank line in the file being read
  472.             continue;
  473.  
  474.         if (token.contains("\\bibdata{")) {
  475.             // run bibtex and
  476.             LString tmp="bibtex ";
  477.             tmp += ChangeExtension(file, LString(), true);
  478.             Systemcalls one;
  479.             one.Startscript(Systemcalls::System, tmp);
  480.             return true;
  481.         }
  482.         
  483.     }
  484.     // bibtex was not run.
  485.     return false;
  486. }
  487.  
  488.  
  489. int LaTeX::scanLogFile(TeXErrors &terr)
  490. {
  491.     LString token;
  492.     int retval = NO_ERRORS;
  493.     
  494.     LyXLex lex(NULL, 0);
  495.  
  496.     LString tmp = ChangeExtension(file, ".log", true);
  497.     
  498.     if (!lex.setFile(tmp)) {
  499.         // unable to open file
  500.         // return at once
  501.         retval |= NO_LOGFILE;
  502.         return retval;
  503.     }
  504.     
  505.     while (lex.IsOK()) {
  506.         if (lex.EatLine())
  507.             token = lex.GetString();
  508.         else // blank line in the file being read
  509.             continue;
  510.  
  511.         lyxerr.debug(token, Error::LATEX);
  512.         
  513.         if (token.prefixIs("LaTeX Warning:")) {
  514.             // Here shall we handle different
  515.             // types of warnings
  516.             retval |= LATEX_WARNING;
  517.             lyxerr.debug("LaTeX Warning.", Error::LATEX);
  518.             if (token.contains("Rerun to get cross-references")) {
  519.                 retval |= RERUN;
  520.                 lyxerr.debug("We should rerun.", Error::LATEX);
  521.             } else if (token.contains("Citation")
  522.                    && token.contains("on page")
  523.                    && token.contains("undefined")) {
  524.                 retval |= UNDEF_CIT;
  525.             }
  526.         } else if (token.prefixIs("Package")) {
  527.             // Package warnings
  528.             retval |= PACKAGE_WARNING;
  529.             if (token.contains("natbib Warning:")) {
  530.                 // Natbib warnings
  531.                 if (token.contains("Citation")
  532.                     && token.contains("on page")
  533.                     && token.contains("undefined")) {
  534.                     retval |= UNDEF_CIT;
  535.                 }
  536.             } else if (token.contains("Rerun LaTeX.")) {
  537.                 // at least longtable.sty might use this.
  538.                 retval |= RERUN;
  539.             }
  540.         } else if (token.prefixIs("! LaTeX Error:")) {
  541.             // Here shall we handle different
  542.             // types of errors
  543.             retval |= LATEX_ERROR;
  544.             lyxerr.debug("LaTeX Error.", Error::LATEX);
  545.             // this is not correct yet
  546.             terr.scanError(lex);
  547.             num_errors++;
  548.         } else if (token.prefixIs("! ")) {
  549.             // TeX Error
  550.             retval |=  TEX_ERROR;
  551.             lyxerr.debug("TeX Error.", Error::LATEX);
  552.             terr.scanError(lex);
  553.             num_errors++;
  554.         } else {
  555.             // information messages, TeX warnings and other
  556.             // warnings we have not caught earlier.
  557.             if (token.prefixIs("Overfull ")) {
  558.                 retval |= TEX_WARNING;
  559.             } else if (token.prefixIs("Underfull ")) {
  560.                 retval |= TEX_WARNING;
  561.             } else if (token.contains("Rerun to get citations")) {
  562.                 // Natbib seems to use this.
  563.                 retval |= RERUN;
  564.             }
  565.         }
  566.     }    
  567.     return retval;
  568. }
  569.  
  570.  
  571. void LaTeX::deplog(DepTable &head)
  572. {
  573.     LString tmp = ChangeExtension(file, ".log", true);
  574.     LyXLex lex(NULL, 0);
  575.     lex.setFile(tmp);
  576.     while (lex.IsOK()) {
  577.         if (!lex.EatLine())
  578.             // blank line in the file being read
  579.             continue;
  580.         
  581.         LString token = lex.GetString();
  582.  
  583.         if (token.empty())
  584.             continue;
  585.         // skip forward in the file until we reach
  586.         // " *File List*"
  587.         else if (token.contains("*File List*")) {
  588.             lyxerr.debug("We got \"*File List*\"!", Error::LATEX);
  589.             while (lex.IsOK()) {
  590.                 // now read line by line until we reach
  591.                 // " ***********"
  592.                 
  593.                 if (!lex.EatLine())
  594.                     continue;
  595.                 
  596.                 token = lex.GetString().frontStrip();
  597.                 if (token.contains("**********")) {
  598.                     lyxerr.debug("End of file"
  599.                               " section.", 
  600.                              Error::LATEX);
  601.                     break;
  602.                 } else {
  603.                     LString foundfile;
  604.                     token.split(foundfile, ' ');
  605.                     lyxerr.debug("Found file: " 
  606.                              + foundfile,
  607.                              Error::LATEX);
  608.                     // Ok now we found a file.
  609.                     // Now we should make sure that
  610.                     // this is a file that we can
  611.                     // access through the normal
  612.                     // paths:
  613.                     // (1) foundfile is an
  614.                     //     absolute path and should
  615.                     //     be inserted.
  616.                     if (AbsolutePath(foundfile)) {
  617.                         head.insert(foundfile);
  618.                         lyxerr.debug("Found file:" 
  619.                                  +foundfile,
  620.                                  Error::LATEX);
  621.                         continue;
  622.                     }
  623.                     // (2) the foundfile can be
  624.                     //     found in the same dir
  625.                     //     as the .lyx file and
  626.                     //     should be inserted.
  627.                     //PathPush(path);
  628.                     Path p(path);
  629.                     if (FileInfo(foundfile).exist()) {
  630.                         head.insert(foundfile);
  631.                         lyxerr.debug("Found file:" 
  632.                                  +foundfile,
  633.                                  Error::LATEX);
  634.                         //PathPop();
  635.                         continue;
  636.                     }
  637.                     //PathPop();
  638.                     p.pop();
  639.  
  640.                     // (3) foundfile is in the tmpdir
  641.                     //     insert it into head
  642.                     if (FileInfo(OnlyFilename(foundfile)).exist()) {
  643.                         head.insert(OnlyFilename(foundfile));
  644.                         lyxerr.debug("Found file:" 
  645.                                  +OnlyFilename(foundfile),
  646.                                  Error::LATEX);
  647.                         continue;
  648.                     }
  649.                 }
  650.             }
  651.         }
  652.         // Here either the log file has been read or not,
  653.         // we don't have to care either way.
  654.     }
  655. }
  656.  
  657.  
  658. void LaTeX::deptex(DepTable &head)
  659. {
  660.     int except = AUX|LOG|DVI|BBL|IND|GLO; 
  661.     LString tmp;
  662.     FileInfo fi;
  663.     for (int i = 0; i < file_count; i++) {
  664.         if (!(all_files[i].file & except)) {
  665.             tmp = ChangeExtension(file,
  666.                           all_files[i].extension,
  667.                           true);
  668.             lyxerr.debug("deptex: " + tmp, Error::LATEX);
  669.             if (fi.newFile(tmp).exist())
  670.                 head.insert(tmp);
  671.         }
  672.     }
  673. }
  674.