diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 2e60f33e2109eb91163ed6d9c2f26255466ec96d..6d035dc08fef94b4387558d2d6a1e3b0c8736928 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -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 diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc index 298fe77c33e379042f1ba86bfbc31e93b78ded60..f765a8975d0106d664bb13a3e36af5164142fc7a 100644 --- a/src/ModelEquationBlock.cc +++ b/src/ModelEquationBlock.cc @@ -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(); diff --git a/src/ModelTree.cc b/src/ModelTree.cc index 8d4ccb22e421add6feb0a3d260fd53abf64e7f7a..cb5819bbd8062f7ce30384d56f8c56e8d842dad9 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -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(); diff --git a/src/ModelTree.hh b/src/ModelTree.hh index 0dc0aa5ac185c864240088ab4e4c8e54474292b2..04c26e952e935d64577d563853fa9d5510925678 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -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 */ diff --git a/src/StaticModel.cc b/src/StaticModel.cc index 6babac0a850c65e10cdb274d7eb2d686dba66a77..75340e6a029f4f9d1a958a0e924b11f7e9d07d94 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -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