diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 76cea6dc390e4c8fd570ed3a968641033c028d98..2c0c5d2978abdd8cbc5cac9d499ec41c409b5466 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -1431,6 +1431,17 @@ WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basen
   static_model.writeLatexFile(basename);
 }
 
+WriteLatexOriginalModelStatement::WriteLatexOriginalModelStatement(const DynamicModel &original_model_arg) :
+  original_model(original_model_arg)
+{
+}
+
+void
+WriteLatexOriginalModelStatement::writeOutput(ostream &output, const string &basename) const
+{
+  original_model.writeLatexOriginalFile(basename);
+}
+
 ShockDecompositionStatement::ShockDecompositionStatement(const SymbolList &symbol_list_arg,
                                                          const OptionsList &options_list_arg) :
   symbol_list(symbol_list_arg),
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index b1a009ffac7e2ed92df869624d27a4762adadd44..36732cc2496eeb7897f72f18c436f1861ef16389 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2014 Dynare Team
+ * Copyright (C) 2003-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -509,6 +509,15 @@ public:
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
 
+class WriteLatexOriginalModelStatement : public Statement
+{
+private:
+  const DynamicModel &original_model;
+public:
+  WriteLatexOriginalModelStatement(const DynamicModel &original_model_arg);
+  virtual void writeOutput(ostream &output, const string &basename) const;
+};
+
 class ShockDecompositionStatement : public Statement
 {
 private:
diff --git a/DynamicModel.cc b/DynamicModel.cc
index fab1f84a9fbd0a97b9aa4596edbf5696b401088f..c261f178abbcd11f95c33a1610e1d4b34621c6be 100644
--- a/DynamicModel.cc
+++ b/DynamicModel.cc
@@ -3997,6 +3997,12 @@ DynamicModel::writeLatexFile(const string &basename) const
   writeLatexModelFile(basename + "_dynamic.tex", oLatexDynamicModel);
 }
 
+void
+DynamicModel::writeLatexOriginalFile(const string &basename) const
+{
+  writeLatexModelFile(basename + "_original.tex", oLatexDynamicModel);
+}
+
 void
 DynamicModel::substituteEndoLeadGreaterThanTwo(bool deterministic_model)
 {
diff --git a/DynamicModel.hh b/DynamicModel.hh
index 7f019f260fc3ffc290bdb3e4159706ba0fe4156f..8efbc5d3c67457efe4f039e6118558016e8e90d7 100644
--- a/DynamicModel.hh
+++ b/DynamicModel.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2014 Dynare Team
+ * Copyright (C) 2003-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -252,6 +252,9 @@ public:
   //! Writes LaTeX file with the equations of the dynamic model
   void writeLatexFile(const string &basename) const;
 
+  //! Writes LaTeX file with the equations of the dynamic model (for the original model)
+  void writeLatexOriginalFile(const string &basename) const;
+
   virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException);
   virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException);
   virtual void addAllParamDerivId(set<int> &deriv_id_set);
diff --git a/DynareBison.yy b/DynareBison.yy
index 737696d4cbd4975722d4ed7f9400d307fa6fb6fe..3760a46edef7676578078b38542f0a66ad7985a8 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -126,7 +126,7 @@ class ParsingDriver;
 %token <string_val> TEX_NAME
 %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
 %token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
-%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL
+%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL
 %token XLS_SHEET XLS_RANGE LONG_NAME
 %left COMMA
 %left EQUAL_EQUAL EXCLAMATION_EQUAL
@@ -250,6 +250,7 @@ statement : parameters
           | identification
           | write_latex_dynamic_model
           | write_latex_static_model
+          | write_latex_original_model
           | shock_decomposition
           | conditional_forecast
           | conditional_forecast_paths
@@ -1906,6 +1907,10 @@ write_latex_static_model : WRITE_LATEX_STATIC_MODEL ';'
                            { driver.write_latex_static_model(); }
                          ;
 
+write_latex_original_model : WRITE_LATEX_ORIGINAL_MODEL ';'
+                           { driver.write_latex_original_model(); }
+                         ;
+
 shock_decomposition : SHOCK_DECOMPOSITION ';'
                       {driver.shock_decomposition(); }
                     | SHOCK_DECOMPOSITION '(' shock_decomposition_options_list ')' ';'
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 040ecf82236bf4925c23f7fdf8f31d87c08a65ef..cf65ff855cd7975f5551b7adacfd8239a03313e0 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -129,6 +129,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <INITIAL>save_params_and_steady_state  {BEGIN DYNARE_STATEMENT; return token::SAVE_PARAMS_AND_STEADY_STATE;}
 <INITIAL>write_latex_dynamic_model  {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_DYNAMIC_MODEL;}
 <INITIAL>write_latex_static_model  {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_STATIC_MODEL;}
+<INITIAL>write_latex_original_model  {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_ORIGINAL_MODEL;}
 
 <INITIAL>steady {BEGIN DYNARE_STATEMENT; return token::STEADY;}
 <INITIAL>check {BEGIN DYNARE_STATEMENT; return token::CHECK;}
diff --git a/ExprNode.cc b/ExprNode.cc
index d4121b72924600e3e2663709300afab1edd0f2b0..d61ebb56f446f3bea5607e7c9afbe080ec1238f4 100644
--- a/ExprNode.cc
+++ b/ExprNode.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2014 Dynare Team
+ * Copyright (C) 2007-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -1851,8 +1851,20 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
       }
       return;
     case oExpectation:
-      cerr << "UnaryOpNode::writeOutput: not implemented on oExpectation" << endl;
-      exit(EXIT_FAILURE);
+      if (!IS_LATEX(output_type))
+        {
+          cerr << "UnaryOpNode::writeOutput: not implemented on oExpectation" << endl;
+          exit(EXIT_FAILURE);
+        }
+      output << "\\mathbb{E}_{t";
+      if (expectation_information_set != 0)
+        {
+          if (expectation_information_set > 0)
+            output << "+";
+          output << expectation_information_set;
+        }
+      output << "}";
+      break;
     case oErf:
       output << "erf";
       break;
diff --git a/ModFile.cc b/ModFile.cc
index 809255973de8f69766798ce2104112b563f1209f..e21cf81e82819134705edcb0647da96abe33c51f 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2014 Dynare Team
+ * Copyright (C) 2006-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -32,6 +32,7 @@
 
 ModFile::ModFile(WarningConsolidation &warnings_arg)
   : expressions_tree(symbol_table, num_constants, external_functions_table),
+    original_model(symbol_table, num_constants, external_functions_table),
     dynamic_model(symbol_table, num_constants, external_functions_table),
     trend_dynamic_model(symbol_table, num_constants, external_functions_table),
     ramsey_FOC_equations_dynamic_model(symbol_table, num_constants, external_functions_table),
@@ -306,6 +307,9 @@ ModFile::checkPass()
 void
 ModFile::transformPass(bool nostrict)
 {
+  // Save the original model (must be done before any model transformations by preprocessor)
+  dynamic_model.cloneDynamic(original_model);
+
   if (nostrict)
     {
       set<int> unusedEndogs = dynamic_model.findUnusedEndogenous();
diff --git a/ModFile.hh b/ModFile.hh
index 04aa1b5e4ac1451a2a075ee2492c3339e94116c8..722ea534196228fa026b57d52ba607d76bb3786c 100644
--- a/ModFile.hh
+++ b/ModFile.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2014 Dynare Team
+ * Copyright (C) 2006-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -51,6 +51,8 @@ public:
   NumericalConstants num_constants;
   //! Expressions outside model block
   DataTree expressions_tree;
+  //! Original model, as declared in the "model" block, that won't be modified by the preprocessor
+  DynamicModel original_model;
   //! Dynamic model, as declared in the "model" block
   DynamicModel dynamic_model;
   //! A copy of Dynamic model, for testing trends declared by user
diff --git a/ModelTree.cc b/ModelTree.cc
index 7bdd78aed948bb82c7030dbd85c9fc4eea340d77..688d4f292d888d43c533a40456f871dc2f976cc4 100644
--- a/ModelTree.cc
+++ b/ModelTree.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2014 Dynare Team
+ * Copyright (C) 2003-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -1352,6 +1352,7 @@ ModelTree::writeLatexModelFile(const string &filename, ExprNodeOutputType output
   output << "\\documentclass[10pt,a4paper]{article}" << endl
          << "\\usepackage[landscape]{geometry}" << endl
          << "\\usepackage{fullpage}" << endl
+         << "\\usepackage{amsfonts}" << endl
          << "\\usepackage{breqn}" << endl
          << "\\begin{document}" << endl
          << "\\footnotesize" << endl;
diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index c7f6b2574e07da1a109a9a2da8d79f753f66f2ad..acf0c8a91424c3a871d4258e97321c82da6f1768 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2014 Dynare Team
+ * Copyright (C) 2003-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -1820,6 +1820,12 @@ ParsingDriver::write_latex_static_model()
   mod_file->addStatement(new WriteLatexStaticModelStatement(mod_file->static_model));
 }
 
+void
+ParsingDriver::write_latex_original_model()
+{
+  mod_file->addStatement(new WriteLatexOriginalModelStatement(mod_file->original_model));
+}
+
 void
 ParsingDriver::bvar_density(string *maxnlags)
 {
diff --git a/ParsingDriver.hh b/ParsingDriver.hh
index a747e896cadb97b75ee5a985265c461d6f6bb826..ace9d1223db80c1ab810a7c66fb4a8dac21a72ce 100644
--- a/ParsingDriver.hh
+++ b/ParsingDriver.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2014 Dynare Team
+ * Copyright (C) 2003-2015 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -503,6 +503,8 @@ public:
   void write_latex_dynamic_model();
   //! Adds a write_latex_static_model statement
   void write_latex_static_model();
+  //! Adds a write_latex_original_model statement
+  void write_latex_original_model();
   //! BVAR marginal density
   void bvar_density(string *maxnlags);
   //! BVAR forecast