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 "OutputParams.h"
19 #include "support/docstring.h"
20 #include "support/FileName.h"
21 #include "support/signals.h"
38 Error () : error_in_line(0) {}
40 Error(int line, docstring const & desc, docstring const & text,
41 std::string const & fname)
42 : error_in_line(line),
46 /// what line in the TeX file the error occurred in
50 /// The line/cmd that caused the error.
52 /// The name of the child where error occurred, empty otherwise.
53 std::string child_name;
57 typedef std::vector<Error> Errors;
59 Errors::const_iterator begin() const { return errors.begin(); }
61 Errors::const_iterator end() const { return errors.end(); }
63 void insertError(int line, docstring const & error_desc,
64 docstring const & error_text,
65 std::string const & child_name = empty_string());
67 void clearErrors() { errors.clear(); }
79 support::FileName aux_file;
81 std::set<std::string> citations;
83 std::set<std::string> databases;
85 std::set<std::string> styles;
90 bool operator==(AuxInfo const &, AuxInfo const &);
91 bool operator!=(AuxInfo const &, AuxInfo const &);
95 * Class to run the LaTeX compiler and needed auxiliary programs.
96 * The main .tex file must be in the current directory. The current directory
97 * must not change as long as an object of this class lives.
98 * This is required by the LaTeX compiler, and we also make use of it by
99 * various support::makeAbsPath() calls.
103 /** Return values from scanLogFile() and run() (to come)
105 This enum should be enlarged a bit so that one could
106 get more feedback from the LaTeX run.
116 UNDEF_REF = 4, // Reference '...' on page ... undefined.
118 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
120 RERUN = 16, // Label(s) may have changed. Rerun to get...
130 PACKAGE_WARNING = 512,
136 TOO_MANY_ERRORS = 4096,
140 BIBTEX_ERROR = 16384,
142 NONZERO_ERROR = 32768, // the command exited with nonzero status
144 ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR,
146 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
149 /// This signal emits an informative message
150 signals2::signal<void(docstring)> message;
154 cmd = the latex command, file = name of the (temporary) latex file,
155 path = name of the files original path,
156 clean_start = This forces a fresh run by deleting the files in the temp
157 dir. We set this e.g. if there was an error on previous
158 preview, which is good if the user installed a package
159 or changed certain document settings (#9061).
161 LaTeX(std::string const & cmd, OutputParams const &,
162 support::FileName const & file,
163 std::string const & path = empty_string(),
164 std::string const & lpath = empty_string(),
165 bool const clean_start = false);
167 /// runs LaTeX several times
168 int run(TeXErrors &);
171 int getNumErrors() { return num_errors;}
174 int scanLogFile(TeXErrors &);
178 LaTeX(LaTeX const &);
179 void operator=(LaTeX const &);
181 /// use this for running LaTeX once
184 /// The dependency file.
185 support::FileName depfile;
188 void deplog(DepTable & head);
191 bool runMakeIndex(std::string const &, OutputParams const &,
192 std::string const & = std::string());
195 bool runMakeIndexNomencl(support::FileName const &,
196 std::string const &, std::string const &);
199 std::vector<AuxInfo> const scanAuxFiles(support::FileName const &,
200 bool const only_childbibs = false);
203 AuxInfo const scanAuxFile(support::FileName const &);
206 void scanAuxFile(support::FileName const &, AuxInfo &);
209 void updateBibtexDependencies(DepTable &,
210 std::vector<AuxInfo> const &);
213 int scanBlgFile(DepTable & head, TeXErrors & terr);
216 bool runBibTeX(std::vector<AuxInfo> const &,
217 OutputParams const &);
220 void removeAuxiliaryFiles() const;
226 support::FileName file;
228 /// The document directory path.
231 /// Extra path, possibly relative to the document directory path.
234 /// used by scanLogFile
237 /// The name of the final output file.
238 support::FileName output_file;
241 OutputParams runparams;
247 std::vector <std::string> children;