diff --git a/matlab/collect_latex_files.m b/matlab/collect_latex_files.m
index 77f98b975ea21db5fe48741002147149c343a21f..0b9f284078c266c6d2814c3bed7695dca63840d5 100644
--- a/matlab/collect_latex_files.m
+++ b/matlab/collect_latex_files.m
@@ -40,15 +40,6 @@ fprintf(fid,'%s \n','\usepackage{breqn}');
 fprintf(fid,'%s \n','\usepackage{float,morefloats,caption}');
 fprintf(fid,'%s \n','\begin{document}');
 
-%% Include LaTeX files from root directory
-TeX_Files=dir([M_.fname,'*.tex']);
-for ii=1:length(TeX_Files)
-    [pathstr,f_name,ext] = fileparts(TeX_Files(ii).name);
-    if ~strcmp(TeX_Files(ii).name,f_name_binder)
-        fprintf(fid,'%s \n',['\include{',f_name,'}']);
-    end
-end
-
 %% Include LaTeX files from <fname>/latex/ directory, except the standalone ones
 TeX_Files=dir([M_.dname filesep 'latex' filesep '*.tex']);
 for ii=1:length(TeX_Files)
diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index f46f684915fa26cb9fddfdaeffb94483623a387d..2245dc290c58a90acd5b3f8db502db979fa821d2 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -560,8 +560,11 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
 
     if ~options_.nograph
         [nbplt,nr,nc,lr,lc,nstar] = pltorg(M_.exo_nbr);
+        if ~exist([M_.fname '/graphs'],'dir')
+            mkdir(M_.fname,'graphs');
+        end
         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
-            fidTeX = fopen([M_.fname '_SmoothedShocks.tex'],'w');
+            fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_SmoothedShocks.tex'],'w');
             fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
             fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
             fprintf(fidTeX,' \n');
@@ -608,14 +611,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
                 end
                 title(name,'Interpreter','none')
             end
-            dyn_saveas(fh,[M_.fname '_SmoothedShocks' int2str(plt)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_SmoothedShocks' int2str(plt)],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fprintf(fidTeX,'\\begin{figure}[H]\n');
                 for jj = 1:nstar0
                     fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
                 end
                 fprintf(fidTeX,'\\centering \n');
-                fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedShocks%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
+                fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedShocks%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
                 fprintf(fidTeX,'\\caption{Smoothed shocks.}');
                 fprintf(fidTeX,'\\label{Fig:SmoothedShocks:%s}\n',int2str(plt));
                 fprintf(fidTeX,'\\end{figure}\n');
@@ -640,7 +643,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
         if ~options_.nograph
             [nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
-                fidTeX = fopen([M_.fname '_SmoothedObservationErrors.tex'],'w');
+                fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_SmoothedObservationErrors.tex'],'w');
                 fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
                 fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
                 fprintf(fidTeX,' \n');
@@ -688,14 +691,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
                     end
                     title(name,'Interpreter','none')
                 end
-                dyn_saveas(fh,[M_.fname '_SmoothedObservationErrors' int2str(plt)],options_.nodisplay,options_.graph_format);
+                dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_SmoothedObservationErrors' int2str(plt)],options_.nodisplay,options_.graph_format);
                 if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                     fprintf(fidTeX,'\\begin{figure}[H]\n');
                     for jj = 1:nstar0
                         fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
                     end
                     fprintf(fidTeX,'\\centering \n');
-                    fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedObservationErrors%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
+                    fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedObservationErrors%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
                     fprintf(fidTeX,'\\caption{Smoothed observation errors.}');
                     fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s}\n',int2str(plt));
                     fprintf(fidTeX,'\\end{figure}\n');
@@ -715,7 +718,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
     if ~options_.nograph
         [nbplt,nr,nc,lr,lc,nstar] = pltorg(n_varobs);
         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
-            fidTeX = fopen([M_.fname '_HistoricalAndSmoothedVariables.tex'],'w');
+            fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_HistoricalAndSmoothedVariables.tex'],'w');
             fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
             fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
             fprintf(fidTeX,' \n');
@@ -763,14 +766,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
                 end
                 title(name,'Interpreter','none')
             end
-            dyn_saveas(fh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fprintf(fidTeX,'\\begin{figure}[H]\n');
                 for jj = 1:nstar0
                     fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
                 end
                 fprintf(fidTeX,'\\centering \n');
-                fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_HistoricalAndSmoothedVariables%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
+                fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_HistoricalAndSmoothedVariables%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
                 fprintf(fidTeX,'\\caption{Historical and smoothed variables.}');
                 fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(plt));
                 fprintf(fidTeX,'\\end{figure}\n');
diff --git a/matlab/mode_check.m b/matlab/mode_check.m
index ca0bb96ab778c4b27feb554847ddbf4c957cb17a..e061af3a2b45688ea42904d0c8ff664483c4f092 100644
--- a/matlab/mode_check.m
+++ b/matlab/mode_check.m
@@ -77,8 +77,11 @@ end
 
 [nbplt,nr,nc,lr,lc,nstar] = pltorg(length(x));
 
+if ~exist([Model.fname filesep 'graphs'],'dir')
+    mkdir(Model.fname,'graphs');
+end
 if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
-    fidTeX = fopen([Model.fname '_CheckPlots.tex'],'w');
+    fidTeX = fopen([Model.fname, '/graphs/', Model.fname '_CheckPlots.tex'],'w');
     fprintf(fidTeX,'%% TeX eps-loader file generated by mode_check.m (Dynare).\n');
     fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
     fprintf(fidTeX,' \n');
@@ -202,7 +205,7 @@ for plt = 1:nbplt
         text(0.25,0.5,'log-post')
         text(0.69,0.5,'log-lik kernel')
     end
-    dyn_saveas(hh,[ Model.fname '_CheckPlots' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
+    dyn_saveas(hh,[Model.fname, '/graphs/', Model.fname '_CheckPlots' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
     if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
         % TeX eps loader file
         fprintf(fidTeX,'\\begin{figure}[H]\n');
@@ -210,7 +213,7 @@ for plt = 1:nbplt
             fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
         end
         fprintf(fidTeX,'\\centering \n');
-        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_CheckPlots%s}\n',DynareOptions.figures.textwidth*min(k/nc,1),Model.fname,int2str(plt));
+        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_CheckPlots%s}\n',DynareOptions.figures.textwidth*min(k/nc,1),[Model.fname, '/graphs/',Model.fname],int2str(plt));
         fprintf(fidTeX,'\\caption{Check plots.}');
         fprintf(fidTeX,'\\label{Fig:CheckPlots:%s}\n',int2str(plt));
         fprintf(fidTeX,'\\end{figure}\n');
diff --git a/matlab/plot_priors.m b/matlab/plot_priors.m
index 2b2fc83f6f41da02b38cf6da3b9ffe9ae939355b..cbe288d2ca8590d608bc4f491a50cbd86d801643 100644
--- a/matlab/plot_priors.m
+++ b/matlab/plot_priors.m
@@ -36,8 +36,11 @@ figurename = 'Priors';
 npar = length(bayestopt_.p1);
 [nbplt,nr,nc,lr,lc,nstar] = pltorg(npar);
 
+if ~exist([M_.fname '/graphs'],'dir')
+    mkdir(M_.fname,'graphs');
+end
 if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
-    fidTeX = fopen([M_.fname '_Priors.tex'],'w');
+    fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_Priors.tex'],'w');
     fprintf(fidTeX,'%% TeX eps-loader file generated by plot_priors.m (Dynare).\n');
     fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
     fprintf(fidTeX,' \n');
@@ -70,14 +73,14 @@ for plt = 1:nbplt
         title(nam,'Interpreter','none')
         drawnow
     end
-    dyn_saveas(hplt,[M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hplt,[M_.fname, '/graphs/' M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format);
     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         fprintf(fidTeX,'\\begin{figure}[H]\n');
         for jj = 1:nstar0
             fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
         end
         fprintf(fidTeX,'\\centering\n');
-        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_Priors%s}\n',options_.figures.textwidth*min(index/nc,1),M_.fname,int2str(plt));
+        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_Priors%s}\n',options_.figures.textwidth*min(index/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
         fprintf(fidTeX,'\\caption{Priors.}');
         fprintf(fidTeX,'\\label{Fig:Priors:%s}\n',int2str(plt));
         fprintf(fidTeX,'\\end{figure}\n');
diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m
index 190796b28ecef648d94c4768bbb04c33fb902857..43e5c068ca3b860d3ddf49acd249cb782594a2b5 100644
--- a/matlab/stoch_simul.m
+++ b/matlab/stoch_simul.m
@@ -201,9 +201,13 @@ end
 
 if options_.irf
     var_listTeX = M_.endo_names_tex(i_var);
-
+    if ~options_.nograph
+        if ~exist([M_.fname '/graphs'],'dir')
+            mkdir(M_.fname,'graphs');
+        end
+    end
     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
-        fidTeX = fopen([M_.fname '_IRF.tex'],'w');
+        fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_IRF.tex'],'w');
         fprintf(fidTeX,'%% TeX eps-loader file generated by stoch_simul.m (Dynare).\n');
         fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
         fprintf(fidTeX,' \n');
@@ -290,14 +294,14 @@ if options_.irf
                         remove_fractional_xticks;
                         title(deblank(mylist(j,:)),'Interpreter','none');
                     end
-                    dyn_saveas(hh,[M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh,[M_.fname, '/graphs/' M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
                     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                         fprintf(fidTeX,'\\begin{figure}[H]\n');
                         for j = 1:number_of_plots_to_draw
                             fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist(j,:)),deblank(mylistTeX(j,:)));
                         end
                         fprintf(fidTeX,'\\centering \n');
-                        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s}\n',options_.figures.textwidth*min(j/nc,1),M_.fname,tit{i});
+                        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s}\n',options_.figures.textwidth*min(j/nc,1),[M_.fname, '/graphs/' M_.fname],tit{i});
                         fprintf(fidTeX,'\\caption{Impulse response functions (orthogonalized shock to $%s$).}\n',titTeX{i});
                         fprintf(fidTeX,'\\label{Fig:IRF:%s}\n', tit{i});
                         fprintf(fidTeX,'\\end{figure}\n');
@@ -322,14 +326,14 @@ if options_.irf
                             remove_fractional_xticks
                             title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none');
                         end
-                        dyn_saveas(hh,[ M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh,[M_.fname, '/graphs/'  M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
                         if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                             fprintf(fidTeX,'\\begin{figure}[H]\n');
                             for j = 1:nstar
                                 fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist((fig-1)*nstar+j,:)),deblank(mylistTeX((fig-1)*nstar+j,:)));
                             end
                             fprintf(fidTeX,'\\centering \n');
-                            fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(plt/nc,1),M_.fname,tit{i},int2str(fig));
+                            fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(plt/nc,1),[M_.fname, '/graphs/' M_.fname],tit{i},int2str(fig));
                             if options_.relative_irf
                                 fprintf(fidTeX,'\\caption{Relative impulse response functions (orthogonalized shock to $%s$).}', titTeX{i});
                             else
@@ -353,14 +357,14 @@ if options_.irf
                         remove_fractional_xticks
                         title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none');
                     end
-                    dyn_saveas(hh,[ M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh,[M_.fname, '/graphs/' M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
                     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                         fprintf(fidTeX,'\\begin{figure}[H]\n');
                         for j = 1:m
                             fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist((nbplt-1)*nstar+j,:)),deblank(mylistTeX((nbplt-1)*nstar+j,:)));
                         end
                         fprintf(fidTeX,'\\centering \n');
-                        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(m/lc,1),M_.fname,tit{i},int2str(nbplt));
+                        fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(m/lc,1),[M_.fname, '/graphs/' M_.fname],tit{i},int2str(nbplt));
                         if options_.relative_irf
                             fprintf(fidTeX,'\\caption{Relative impulse response functions (orthogonalized shock to $%s$).}', titTeX{i});
                         else
diff --git a/matlab/write_latex_definitions.m b/matlab/write_latex_definitions.m
index 30e96506f01a31de518ad03976809af014cfebde..531e799cf6633699a9e381f4c47c6b5eecc18fc7 100644
--- a/matlab/write_latex_definitions.m
+++ b/matlab/write_latex_definitions.m
@@ -12,7 +12,7 @@ function write_latex_definitions
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright (C) 2013-2018 Dynare Team
+% Copyright (C) 2013-2019 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -39,7 +39,10 @@ else
     M_var_root = {'M_.endo', 'M_.exo', 'M_.exo_det', 'M_.param'};
 end
 
-fid = fopen([M_.fname '_latex_definitions.tex'], 'w');
+if ~exist([M_.fname '/latex'],'dir')
+    mkdir(M_.fname,'latex');
+end
+fid = fopen([M_.fname, '/latex/' M_.fname '_latex_definitions.tex'], 'w');
 for i=1:length(tables)
     fprintf(fid, '\\begin{center}\n');
     fprintf(fid, '\\begin{longtable}{ccc}\n');
diff --git a/matlab/write_latex_parameter_table.m b/matlab/write_latex_parameter_table.m
index 7d76880ff7cf76bf4d01a6ce04e60412fb5c6d6a..8b1b1b98b4705c7c63a5ec77923f802f122e2fd1 100644
--- a/matlab/write_latex_parameter_table.m
+++ b/matlab/write_latex_parameter_table.m
@@ -12,7 +12,7 @@ function write_latex_parameter_table
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright (C) 2015-2018 Dynare Team
+% Copyright (C) 2015-2019 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -37,7 +37,11 @@ if ~isequal(M_.param_names, M_.param_names_long)
     Long_names_present = true;
 end
 
-fid = fopen([M_.fname '_latex_parameters.tex'], 'w');
+if ~exist([M_.fname '/latex'],'dir')
+    mkdir(M_.fname,'latex');
+end
+            
+fid = fopen([M_.fname, '/latex/' M_.fname '_latex_parameters.tex'], 'w');
 fprintf(fid, '\\begin{center}\n');
 if Long_names_present==1
     fprintf(fid, '\\begin{longtable}{ccc}\n');
diff --git a/matlab/write_latex_prior_table.m b/matlab/write_latex_prior_table.m
index 2fb738bd73d9895309631f2b1e541e34213eaff1..3bae6d8c5c4568dfe12349973020e4dff1b8c2d9 100644
--- a/matlab/write_latex_prior_table.m
+++ b/matlab/write_latex_prior_table.m
@@ -11,7 +11,7 @@ function write_latex_prior_table
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright (C) 2015-2017 Dynare Team
+% Copyright (C) 2015-2019 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -54,7 +54,10 @@ ub=bounds.ub;
 
 PriorNames = { 'Beta' , 'Gamma' , 'Gaussian' , 'Inv. Gamma' , 'Uniform' , 'Inv. Gamma -- 2', '', 'Weibull' };
 
-fidTeX = fopen([Model.fname '_priors_table.tex'],'w+');
+if ~exist([M_.fname '/latex'],'dir')
+    mkdir(M_.fname,'latex');
+end
+fidTeX = fopen([M_.fname, '/latex/' Model.fname '_priors_table.tex'],'w+');
 fprintf(fidTeX,'%% TeX-table generated by Dynare write_latex_prior_table.m.\n');
 fprintf(fidTeX,'%% Prior Information\n');
 fprintf(fidTeX,['%% ' datestr(now,0)]);