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"
22 #include <boost/utility.hpp>
23 #include <boost/signal.hpp>
40 Error () : error_in_line(0) {}
42 Error(int line
, docstring
const & desc
, docstring
const & text
)
43 : error_in_line(line
),
46 /// what line in the TeX file the error occured in
50 /// The line/cmd that caused the error.
55 typedef std::vector
<Error
> Errors
;
57 Errors::const_iterator
begin() const { return errors
.begin(); }
59 Errors::const_iterator
end() const { return errors
.end(); }
61 void insertError(int line
, docstring
const & error_desc
,
62 docstring
const & error_text
);
74 support::FileName aux_file
;
76 std::set
<std::string
> citations
;
78 std::set
<std::string
> databases
;
80 std::set
<std::string
> styles
;
85 bool operator==(Aux_Info
const &, Aux_Info
const &);
86 bool operator!=(Aux_Info
const &, Aux_Info
const &);
90 * Class to run the LaTeX compiler and needed auxiliary programs.
91 * The main .tex file must be in the current directory. The current directory
92 * must not change as long as an object of this class lives.
93 * This is required by the LaTeX compiler, and we also make use of it by
94 * various support::makeAbsPath() calls.
96 class LaTeX
: boost::noncopyable
{
98 /** Return values from scanLogFile() and run() (to come)
100 This enum should be enlarged a bit so that one could
101 get more feedback from the LaTeX run.
111 UNDEF_REF
= 4, // Reference '...' on page ... undefined.
113 UNDEF_CIT
= 8, // Citation '...' on page ... undefined.
115 RERUN
= 16, // Label(s) may have changed. Rerun to get...
125 PACKAGE_WARNING
= 512,
131 TOO_MANY_ERRORS
= 4096,
135 ERRORS
= TEX_ERROR
+ LATEX_ERROR
,
137 WARNINGS
= TEX_WARNING
+ LATEX_WARNING
+ PACKAGE_WARNING
140 /// This signal emits an informative message
141 boost::signal
<void(docstring
)> message
;
145 cmd = the latex command, file = name of the (temporary) latex file,
146 path = name of the files original path.
148 LaTeX(std::string
const & cmd
, OutputParams
const &,
149 support::FileName
const & file
);
151 /// runs LaTeX several times
152 int run(TeXErrors
&);
155 int getNumErrors() { return num_errors
;}
158 int scanLogFile(TeXErrors
&);
161 /// use this for running LaTeX once
164 /// The dependency file.
165 support::FileName depfile
;
168 void deplog(DepTable
& head
);
171 bool runMakeIndex(std::string
const &, OutputParams
const &,
172 std::string
const & = std::string());
175 bool runMakeIndexNomencl(support::FileName
const &, OutputParams
const &,
176 std::string
const &, std::string
const &);
179 std::vector
<Aux_Info
> const scanAuxFiles(support::FileName
const &);
182 Aux_Info
const scanAuxFile(support::FileName
const &);
185 void scanAuxFile(support::FileName
const &, Aux_Info
&);
188 void updateBibtexDependencies(DepTable
&,
189 std::vector
<Aux_Info
> const &);
192 bool runBibTeX(std::vector
<Aux_Info
> const &);
195 void deleteFilesOnError() const;
201 support::FileName file
;
203 /// used by scanLogFile
206 /// The name of the final output file.
207 support::FileName output_file
;
210 OutputParams runparams
;