Generated LaTeX files are now under <basename>/latex/

issue#70
Sébastien Villemot 2019-07-11 17:33:53 +02:00
parent ac9d352a2c
commit 0988a1f755
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
5 changed files with 15 additions and 13 deletions

View File

@ -6062,13 +6062,13 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
void
DynamicModel::writeLatexFile(const string &basename, const bool write_equation_tags) const
{
writeLatexModelFile(basename + "_dynamic", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
writeLatexModelFile(basename, "dynamic", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
}
void
DynamicModel::writeLatexOriginalFile(const string &basename, const bool write_equation_tags) const
{
writeLatexModelFile(basename + "_original", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
writeLatexModelFile(basename, "original", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
}
void

View File

@ -132,10 +132,11 @@ SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat
void
SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
{
boost::filesystem::create_directories(basename + "/latex");
ofstream output, content_output;
string filename = basename + "_steady_state.tex";
string content_basename = basename + "_steady_state_content";
string content_filename = content_basename + ".tex";
string filename = basename + "/latex/steady_state.tex";
string content_filename = basename + "/latex/steady_state_content.tex";
output.open(filename, ios::out | ios::binary);
if (!output.is_open())
@ -172,7 +173,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
static_model.writeLatexAuxVarRecursiveDefinitions(content_output);
output << "\\include{" << content_basename << "}" << endl
output << "\\include{steady_state_content.tex}" << endl
<< "\\end{document}" << endl;
output.close();

View File

@ -1834,12 +1834,13 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
}
void
ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags) const
ModelTree::writeLatexModelFile(const string &mod_basename, const string &latex_basename, ExprNodeOutputType output_type, const bool write_equation_tags) const
{
boost::filesystem::create_directories(mod_basename + "/latex");
ofstream output, content_output;
string filename = basename + ".tex";
string content_basename = basename + "_content";
string content_filename = content_basename + ".tex";
string filename = mod_basename + "/latex/" + latex_basename + ".tex";
string content_filename = mod_basename + "/latex/" + latex_basename + "_content" + ".tex";
output.open(filename, ios::out | ios::binary);
if (!output.is_open())
{
@ -1906,7 +1907,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
content_output << endl << R"(\end{dmath})" << endl;
}
output << R"(\include{)" << content_basename << "}" << endl
output << R"(\include{)" << latex_basename + "_content" << "}" << endl
<< R"(\end{document})" << endl;
output.close();

View File

@ -191,7 +191,7 @@ protected:
void compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
//! Writes LaTeX model file
void writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags) const;
void writeLatexModelFile(const string &mod_basename, const string &latex_basename, ExprNodeOutputType output_type, const bool write_equation_tags) const;
//! Sparse matrix of double to store the values of the Jacobian
/*! First index is equation number, second index is endogenous type specific ID */

View File

@ -2380,7 +2380,7 @@ StaticModel::collect_block_first_order_derivatives()
void
StaticModel::writeLatexFile(const string &basename, bool write_equation_tags) const
{
writeLatexModelFile(basename + "_static", ExprNodeOutputType::latexStaticModel, write_equation_tags);
writeLatexModelFile(basename, "static", ExprNodeOutputType::latexStaticModel, write_equation_tags);
}
void