4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Angus Leeming
11 * Full author contact details are available in file CREDITS.
17 #include "latexrunparams.h"
23 #include <boost/utility.hpp>
24 #include <boost/signals/signal1.hpp>
32 Error () : error_in_line(0) {}
34 Error(int line, string const & desc, string const & text)
35 : error_in_line(line),
38 /// what line in the TeX file the error occured in
42 /// The line/cmd that caused the error.
47 typedef std::vector<Error> Errors;
49 Errors::const_iterator begin() const { return errors.begin(); }
51 Errors::const_iterator end() const { return errors.end(); }
53 void insertError(int line, string const & error_desc,
54 string const & error_text);
68 std::set<string> citations;
70 std::set<string> databases;
72 std::set<string> styles;
77 bool operator==(Aux_Info const &, Aux_Info const &);
78 bool operator!=(Aux_Info const &, Aux_Info const &);
82 class LaTeX : boost::noncopyable {
84 /** Return values from scanLogFile() and run() (to come)
86 This enum should be enlarged a bit so that one could
87 get more feedback from the LaTeX run.
97 UNDEF_REF = 4, // Reference '...' on page ... undefined.
99 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
101 RERUN = 16, // Label(s) may have changed. Rerun to get...
111 PACKAGE_WARNING = 512,
117 TOO_MANY_ERRORS = 4096,
121 ERRORS = TEX_ERROR + LATEX_ERROR,
123 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
126 /// This signal emits an informative message
127 boost::signal1<void, string> message;
131 cmd = the latex command, file = name of the (temporary) latex file,
132 path = name of the files original path.
134 LaTeX(string const & cmd, LatexRunParams const &,
135 string const & file, string const & path);
137 /// runs LaTeX several times
138 int run(TeXErrors &);
141 int getNumErrors() { return num_errors;}
144 int scanLogFile(TeXErrors &);
147 /// use this for running LaTeX once
150 /// The dependency file.
154 void deplog(DepTable & head);
157 bool runMakeIndex(string const &);
160 std::vector<Aux_Info> const scanAuxFiles(string const &);
163 Aux_Info const scanAuxFile(string const &);
166 void scanAuxFile(string const &, Aux_Info &);
169 void updateBibtexDependencies(DepTable &,
170 std::vector<Aux_Info> const &);
173 bool runBibTeX(std::vector<Aux_Info> const &);
176 void deleteFilesOnError() const;
187 /// used by scanLogFile
190 /// The name of the final output file.
194 LatexRunParams runparams;