diff --git a/matlab/PlotPosteriorDistributions.m b/matlab/PlotPosteriorDistributions.m index 99b81a01be0a0e74cba598d2755b37de63d05e04..aac95569fbb470d821fb01b2a1f462bc56ac70f8 100644 --- a/matlab/PlotPosteriorDistributions.m +++ b/matlab/PlotPosteriorDistributions.m @@ -66,17 +66,6 @@ for i=1:npar hfig=dyn_figure(options_.nodisplay, 'Name', figurename); end [nam,texnam] = get_the_name(i, TeX, M_, estim_params_, options_); - if subplotnum == 1 - NAMES = {nam}; - if TeX - TeXNAMES = {texnam}; - end - else - NAMES = [NAMES; {nam}]; - if TeX - TeXNAMES = [TeXNAMES; {texnam}]; - end - end [x2, f2, abscissa, dens, binf2, bsup2] = draw_prior_density(i, bayestopt_); top2 = max(f2); if i <= nvx @@ -148,16 +137,17 @@ for i=1:npar end box on axis([borneinf bornesup 0 1.1*top0]) - title(nam, 'Interpreter', 'none') + if TeX + title(texnam, 'Interpreter', 'latex') + else + title(nam, 'Interpreter', 'none') + end hold off drawnow if subplotnum == MaxNumberOfPlotPerFigure || i == npar dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)], options_.nodisplay, options_.graph_format); if TeX && any(strcmp('eps', cellstr(options_.graph_format))) fprintf(fidTeX, '\\begin{figure}[H]\n'); - for j = 1:size(NAMES, 1) - fprintf(fidTeX, '\\psfrag{%s}[1][][0.5][0]{%s}\n', NAMES{j}, TeXNAMES{j}); - end fprintf(fidTeX, '\\centering\n'); fprintf(fidTeX, '\\includegraphics[width=%2.2f\\textwidth]{%s/%s_PriorsAndPosteriors%s}\n', ... options_.figures.textwidth*min(subplotnum/nn,1), OutputDirectoryName, M_.fname, int2str(figunumber)); diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m index 6f6deb913b489d45bdc72bbdda1aaa8be94fd32b..07b11383c020eb3e1d5dc21e5927e894603a90b5 100644 --- a/matlab/PosteriorIRF.m +++ b/matlab/PosteriorIRF.m @@ -391,7 +391,6 @@ if ~options_.nograph && ~options_.no_graph.posterior % The files .TeX are genereted in sequential way always! - % The files .TeX are generated in sequential way always! subplotnum = 0; titTeX(M_.exo_names_orig_ord) = M_.exo_names_tex; if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format))) @@ -411,9 +410,6 @@ if ~options_.nograph && ~options_.no_graph.posterior if subplotnum == 1 fprintf(fidTeX,'\\begin{figure}[H]\n'); end - name = varlist{jj}; - texname = varlist_TeX{jj}; - fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{%s}\n'],name,['$' texname '$']); end if subplotnum == MaxNumberOfPlotPerFigure || (jj == nvar && subplotnum> 0) figunumber = figunumber+1; @@ -438,8 +434,6 @@ if ~options_.nograph && ~options_.no_graph.posterior % The others file format are generated in parallel by PosteriorIRF_core2! - - % Comment for testing! if ~isoctave if isnumeric(options_.parallel) || (M_.exo_nbr*ceil(length(varlist)/MaxNumberOfPlotPerFigure))<8 [fout] = PosteriorIRF_core2(localVars,1,M_.exo_nbr,0); diff --git a/matlab/PosteriorIRF_core2.m b/matlab/PosteriorIRF_core2.m index 2b95c570fd085089a6baf08c315cf7455493d54a..522888e3894ac9865325c8927529481a17e4b5cc 100644 --- a/matlab/PosteriorIRF_core2.m +++ b/matlab/PosteriorIRF_core2.m @@ -142,8 +142,11 @@ for i=fpar:npar remove_fractional_xticks; hold off end - name = varlist{j}; - title(name,'Interpreter','none') + if options_.TeX + title(['$' varlist_TeX{j} '$'],'Interpreter','latex') + else + title(varlist{j},'Interpreter','none') + end else if options_.debug fprintf('POSTERIOR_IRF: The IRF of %s to %s is smaller than the irf_plot_threshold of %4.3f and will not be displayed.\n',varlist{j},tit{i},options_.impulse_responses.plot_threshold) diff --git a/matlab/convergence_diagnostics/McMCDiagnostics.m b/matlab/convergence_diagnostics/McMCDiagnostics.m index 44c4f872dfee70f25c1c319f41bd7f4248cbb981..69d368291273c46831bc056d4039df33f8de7e9b 100644 --- a/matlab/convergence_diagnostics/McMCDiagnostics.m +++ b/matlab/convergence_diagnostics/McMCDiagnostics.m @@ -306,31 +306,24 @@ for i = 1:pages plt2 = UDIAG(:,6,k); namnam = [nam , ' (m3)']; end - if TeX - if j==1 - NAMES = deblank(namnam); - TEXNAMES = deblank(namtex); - else - NAMES = char(NAMES,deblank(namnam)); - TEXNAMES = char(TEXNAMES,deblank(namtex)); - end - end subplot(3,3,boxplot); plot(xx,plt1,'-b'); % Pooled hold on; plot(xx,plt2,'-r'); % Within (mean) hold off; xlim([xx(1) xx(NumberOfLines)]) - title(namnam,'Interpreter','none') + if TeX + title(namtex,'interpreter','latex') + else + title(namnam,'Interpreter','none') + end + boxplot = boxplot + 1; end end dyn_saveas(h,[OutputFolder '/' ModelName '_udiag' int2str(i)],options_.nodisplay,options_.graph_format); if TeX && any(strcmp('eps',cellstr(options_.graph_format))) fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(NAMES,1) - 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_udiag%s}\n',options_.figures.textwidth*min((boxplot-1)/3,1),[OutputFolder '/' ModelName],int2str(i)); fprintf(fidTeX,'\\caption{Univariate convergence diagnostics for the Metropolis-Hastings.\n'); @@ -360,22 +353,22 @@ if reste plt1 = UDIAG(:,1,k); plt2 = UDIAG(:,2,k); namnam = [nam , ' (Interval)']; + if TeX + namnamtex = [namtex , ' (Interval)']; + end elseif crit == 2 plt1 = UDIAG(:,3,k); plt2 = UDIAG(:,4,k); namnam = [nam , ' (m2)']; + if TeX + namnamtex = [namtex , ' (m2)']; + end elseif crit == 3 plt1 = UDIAG(:,5,k); plt2 = UDIAG(:,6,k); namnam = [nam , ' (m3)']; - end - if TeX - if j==1 - NAMES = deblank(namnam); - TEXNAMES = deblank(namtex); - else - NAMES = char(NAMES,deblank(namnam)); - TEXNAMES = char(TEXNAMES,deblank(namtex)); + if TeX + namnamtex = [namtex , ' (m3)']; end end subplot(nr,nc,boxplot); @@ -384,16 +377,17 @@ if reste plot(xx,plt2,'-r'); % Within (mean) hold off; xlim([xx(1) xx(NumberOfLines)]); - title(namnam,'Interpreter','none'); + if TeX + title(namnamtex,'Interpreter','latex'); + else + title(namnam,'Interpreter','none'); + end boxplot = boxplot + 1; end end dyn_saveas(h,[ OutputFolder '/' ModelName '_udiag' int2str(pages+1)],options_.nodisplay,options_.graph_format); if TeX && any(strcmp('eps',cellstr(options_.graph_format))) fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(NAMES,1) - 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_udiag%s}\n',options_.figures.textwidth*min((boxplot-1)/nc,1),[OutputFolder '/' ModelName],int2str(pages+1)); if reste == 2 @@ -477,13 +471,6 @@ for crit = 1:3 plt2 = MDIAG(:,6); namnam = 'm3'; end - if TeX - if crit == 1 - NAMES = deblank(namnam); - else - NAMES = char(NAMES,deblank(namnam)); - end - end subplot(3,1,boxplot); plot(xx,plt1,'-b'); % Pooled hold on @@ -497,9 +484,6 @@ dyn_saveas(h,[ OutputFolder '/' ModelName '_mdiag'],options_.nodisplay,options_. if TeX && any(strcmp('eps',cellstr(options_.graph_format))) fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:3 - fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),' '); - end fprintf(fidTeX,'\\centering \n'); fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s_mdiag}\n',[OutputFolder '/' ModelName]); fprintf(fidTeX,'\\caption{Multivariate convergence diagnostics for the Metropolis-Hastings.\n'); diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index e27931d1d73a8e7078ab72b8a09387ac1e37ed7e..e2dbfc9f7789116471360f7b9282b39aca22f2b1 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -589,11 +589,6 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha plot(1:gend,innov(k,:),marker_string{2,1},'linewidth',1) hold off name = M_.exo_names{k}; - if isempty(NAMES) - NAMES = name; - else - NAMES = char(NAMES,name); - end if ~isempty(options_.XTick) set(gca,'XTick',options_.XTick) set(gca,'XTickLabel',options_.XTickLabel) @@ -602,21 +597,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha xlim([1 gend]) end if options_.TeX - texname = M_.exo_names_tex{k}; - if isempty(TeXNAMES) - TeXNAMES = ['$ ' deblank(texname) ' $']; - else - TeXNAMES = char(TeXNAMES,['$ ' deblank(texname) ' $']); - end + title(['$' M_.exo_names_tex{k} '$'],'Interpreter','latex') + else + title(name,'Interpreter','none') end - title(name,'Interpreter','none') end 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, '/graphs/' M_.fname],int2str(plt)); fprintf(fidTeX,'\\caption{Smoothed shocks.}'); @@ -650,8 +638,6 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha end for plt = 1:nbplt fh = dyn_figure(options_.nodisplay,'Name','Smoothed observation errors'); - NAMES = []; - if options_.TeX, TeXNAMES = []; end nstar0=min(nstar,number_of_plots_to_draw-(plt-1)*nstar); if gend==1 marker_string{1,1}='-ro'; @@ -671,32 +657,20 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha if gend>1 xlim([1 gend]) end - if isempty(NAMES) - NAMES = name; - else - NAMES = char(NAMES,name); - end if ~isempty(options_.XTick) set(gca,'XTick',options_.XTick) set(gca,'XTickLabel',options_.XTickLabel) end if options_.TeX idx = strmatch(options_.varobs{index(k)}, M_.endo_names, 'exact'); - texname = M_.endo_names_tex{idx}; - if isempty(TeXNAMES) - TeXNAMES = ['$ ' texname ' $']; - else - TeXNAMES = char(TeXNAMES,['$ ' texname ' $']); - end + title(['$' M_.endo_names_tex{idx} '$'],'Interpreter','latex') + else + title(name,'Interpreter','none') end - title(name,'Interpreter','none') end 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, '/graphs/' M_.fname],int2str(plt)); fprintf(fidTeX,'\\caption{Smoothed observation errors.}'); @@ -726,7 +700,6 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha for plt = 1:nbplt fh = dyn_figure(options_.nodisplay,'Name','Historical and smoothed variables'); NAMES = []; - if options_.TeX, TeXNAMES = []; end nstar0=min(nstar,n_varobs-(plt-1)*nstar); if gend==1 marker_string{1,1}='-ro'; @@ -743,11 +716,6 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha plot(1:gend,rawdata(:,k),marker_string{2,1},'linewidth',1) hold off name = options_.varobs{k}; - if isempty(NAMES) - NAMES = name; - else - NAMES = char(NAMES,name); - end if ~isempty(options_.XTick) set(gca,'XTick',options_.XTick) set(gca,'XTickLabel',options_.XTickLabel) @@ -757,21 +725,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha end if options_.TeX idx = strmatch(options_.varobs{k}, M_.endo_names,'exact'); - texname = M_.endo_names_tex{idx}; - if isempty(TeXNAMES) - TeXNAMES = ['$ ' texname ' $']; - else - TeXNAMES = char(TeXNAMES,['$ ' texname ' $']); - end + title(['$' M_.endo_names_tex{idx} '$'],'Interpreter','latex') + else + title(name,'Interpreter','none') end - title(name,'Interpreter','none') end 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, '/graphs/' M_.fname],int2str(plt)); fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); diff --git a/matlab/forecast_graphs.m b/matlab/forecast_graphs.m index e2815c76c5e0b0587c28ea219b530c229aba60b7..00006d0e261affc93a488175cd4118dc3face4eb 100644 --- a/matlab/forecast_graphs.m +++ b/matlab/forecast_graphs.m @@ -87,7 +87,12 @@ for j= 1:nvar plot([NaN(obs,1); hpdinf.(vn)],'b-'); hold on plot([NaN(obs,1); hpdsup.(vn)],'b-'); - title(vn,'Interpreter','none'); + if options_.TeX + temp=strmatch(vn,M_.endo_names,'exact'); + title(['$' M_.endo_names_tex{temp} '$'],'Interpreter','latex'); + else + title(vn,'Interpreter','none'); + end xlim([1 obs+length(hpdsup.(vn))]) hold off m = m + 1; @@ -145,7 +150,12 @@ if isfield(oo_.forecast,'HPDinf_ME') plot([NaN(obs,1); oo_.forecast.HPDinf_ME.(vn)],'b-'); hold on plot([NaN(obs,1); oo_.forecast.HPDsup_ME.(vn)],'b-'); - title(vn,'Interpreter','none'); + if options_.TeX + temp=strmatch(vn,M_.endo_names,'exact'); + title(['$' M_.endo_names_tex{temp} '$'],'Interpreter','latex'); + else + title(vn,'Interpreter','none'); + end xlim([1 obs+length(oo_.forecast.HPDsup_ME.(vn))]) hold off m = m + 1; diff --git a/matlab/get_the_name.m b/matlab/get_the_name.m index 7da451d11764fee9a6079db8783c8de00df2a5ac..d7dddee6d0b1f3781eaac8d3196cb2a8adf136eb 100644 --- a/matlab/get_the_name.m +++ b/matlab/get_the_name.m @@ -70,14 +70,14 @@ if k <= nvx nam = sprintf('SE_%s', vname); if TeX tname = M_.exo_names_tex{estim_params_.var_exo(k,1)}; - texnam = sprintf('$ SE_{%s} $', tname); + texnam = sprintf('$ \\sigma_{%s} $', tname); end elseif k <= (nvx+nvn) vname = options_.varobs{estim_params_.nvn_observable_correspondence(k-estim_params_.nvx,1)}; nam = sprintf('SE_EOBS_%s', vname); if TeX tname = M_.endo_names_tex{estim_params_.var_endo(k-estim_params_.nvx,1)}; - texnam = sprintf('$ EOBS SE_{%s} $', tname); + texnam = sprintf('$ \\sigma^{ME}_{%s} $', tname); end elseif k <= (nvx+nvn+ncx) jj = k - (nvx+nvn); @@ -87,7 +87,7 @@ elseif k <= (nvx+nvn+ncx) nam = sprintf('CC_%s', vname); if TeX tname = sprintf('%s,%s', M_.exo_names_tex{k1}, M_.exo_names_tex{k2}); - texnam = sprintf('$ CC_{%s} $', tname); + texnam = sprintf('$ \\rho_{%s} $', tname); end elseif k <= (nvx+nvn+ncx+ncn) jj = k - (nvx+nvn+ncx); @@ -97,7 +97,7 @@ elseif k <= (nvx+nvn+ncx+ncn) nam = sprintf('CC_EOBS_%s', vname); if TeX tname = sprintf('%s,%s', M_.endo_names_tex{k1}, M_.endo_names_tex{k2}); - texnam = sprintf('$ EOBS CC_{%s} $', tname); + texnam = sprintf('$ \\rho^{ME}_{%s} $', tname); end else jj = k - (nvx+nvn+ncx+ncn); diff --git a/matlab/mode_check.m b/matlab/mode_check.m index 5a9970981dbb9130ae8a1cef97dc763058804334..ada266663ab826cee03b1923e9517abf65f78d62 100644 --- a/matlab/mode_check.m +++ b/matlab/mode_check.m @@ -104,15 +104,6 @@ for plt = 1:nbplt subplot(nr,nc,k) kk = (plt-1)*nstar+k; [name,texname] = get_the_name(kk,TeX,Model,EstimatedParameters,DynareOptions); - if TeX - if isempty(NAMES) - NAMES = name; - TeXNAMES = texname; - else - NAMES = char(NAMES,name); - TeXNAMES = char(TeXNAMES,texname); - end - end xx = x; if x(kk)~=0 || ~isinf(BoundsInfo.lb(kk)) || ~isinf(BoundsInfo.lb(kk)) l1 = max(BoundsInfo.lb(kk),(1-sign(x(kk))*ll)*x(kk)); m1 = 0; %lower bound @@ -182,7 +173,12 @@ for plt = 1:nbplt zNaN = z(NaN_index); yNaN = yl(1)*ones(size(NaN_index)); plot(zNaN,yNaN,'o','MarkerEdgeColor','r','MarkerFaceColor','r','MarkerSize',6); - title(name,'interpreter','none') + if TeX + title(texname,'interpreter','latex') + else + title(name,'interpreter','none') + end + axis tight if binding_lower_bound || binding_upper_bound xl=get(gca,'xlim'); @@ -209,9 +205,6 @@ for plt = 1:nbplt if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format))) % TeX eps loader file fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:min(nstar,length(x)-(plt-1)*nstar) - 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, '/graphs/',Model.fname],int2str(plt)); fprintf(fidTeX,'\\caption{Check plots.}'); diff --git a/matlab/plot_priors.m b/matlab/plot_priors.m index cbe288d2ca8590d608bc4f491a50cbd86d801643..02d7826688b28ca9c0d071f121d652d49b9890d2 100644 --- a/matlab/plot_priors.m +++ b/matlab/plot_priors.m @@ -57,28 +57,20 @@ for plt = 1:nbplt i = (plt-1)*nstar + index; [x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_); [nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_); - if TeX - if index==1 - TeXNAMES = texnam; - NAMES = nam; - else - TeXNAMES = char(TeXNAMES,texnam); - NAMES = char(NAMES,nam); - end - end subplot(nr,nc,index) hh = plot(x,f,'-k','linewidth',2); set(hh,'color',[0.7 0.7 0.7]); box on - title(nam,'Interpreter','none') + if TeX + title(texnam,'Interpreter','latex') + else + title(nam,'Interpreter','none') + end drawnow end 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, '/graphs/' M_.fname],int2str(plt)); fprintf(fidTeX,'\\caption{Priors.}'); diff --git a/matlab/pm3.m b/matlab/pm3.m index f32468b40e7a09a8fd7022a76dd49f82c09d2892..3d93b04c1bcb87d22e09798a28dec05795d951a1 100644 --- a/matlab/pm3.m +++ b/matlab/pm3.m @@ -307,6 +307,9 @@ if ~options_.nograph && ~options_.no_graph.posterior localVars.n2=n2; localVars.Distrib=Distrib; localVars.varlist=varlist; + if options_.TeX + localVars.varlist_TeX=varlist_TeX; + end localVars.MaxNumberOfPlotsPerFigure=MaxNumberOfPlotsPerFigure; localVars.name3=name3; localVars.tit3=tit3; @@ -352,28 +355,14 @@ if ~options_.nograph && ~options_.no_graph.posterior i=0; for j=1:length(nvar0) - NAMES = []; - TEXNAMES = []; nvar=nvar0(j); while i<nvar i=i+1; if max(abs(Mean(:,i))) > 10^(-6) subplotnum = subplotnum+1; - name = varlist{i}; - texname = varlist_TeX{i}; - if subplotnum==1 - NAMES = name; - TEXNAMES = ['$' texname '$']; - else - NAMES = char(NAMES,name); - TEXNAMES = char(TEXNAMES,['$' texname '$']); - end end if subplotnum == MaxNumberOfPlotsPerFigure || i == nvar fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(TEXNAMES,1) - 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/Output/%s_' name3 '_%s}\n'],options_.figures.textwidth*min(subplotnum/nn,1),M_.dname,M_.fname, tit3{i}); fprintf(fidTeX,'\\label{Fig:%s:%s}\n',name3,tit3{i}); @@ -381,8 +370,6 @@ if ~options_.nograph && ~options_.no_graph.posterior fprintf(fidTeX,'\\end{figure}\n'); fprintf(fidTeX,' \n'); subplotnum = 0; - NAMES = []; - TEXNAMES = []; end end end diff --git a/matlab/pm3_core.m b/matlab/pm3_core.m index b75950937687690c09cd7e23cd4d858a22ef3455..a820f6ad452698fef15bd86a92ad3fd163b92c8a 100644 --- a/matlab/pm3_core.m +++ b/matlab/pm3_core.m @@ -42,6 +42,7 @@ nn=myinputs.nn; n2=myinputs.n2; Distrib=myinputs.Distrib; varlist=myinputs.varlist; + MaxNumberOfPlotsPerFigure=myinputs.MaxNumberOfPlotsPerFigure; name3=myinputs.name3; tit3=myinputs.tit3; @@ -54,6 +55,9 @@ end global options_ M_ oo_ +if options_.TeX + varlist_TeX=myinputs.varlist_TeX; +end if whoiam prct0={0,whoiam,Parallel(ThisMatlab)}; @@ -89,8 +93,11 @@ for i=fpar:nvar plot(1:n2,Mean(:,i),'-k','linewidth',1); xlim([1 n2]); hold off; - name = deblank(varlist(i,:)); - title(name,'Interpreter','none') + if options_.TeX + title(['$' varlist_TeX{i,:} '$'],'Interpreter','latex') + else + title(varlist(i,:),'Interpreter','none') + end yticklabels=get(gca,'yticklabel'); if size(char(yticklabels),2)>5 %make sure yticks do not screw up figure yticks=get(gca,'ytick'); diff --git a/matlab/prior_posterior_statistics.m b/matlab/prior_posterior_statistics.m index 3a638882d5e73f630759bd5aed389282d88b2958..c52dd7701028207be9f9abef1dab327d876ec197 100644 --- a/matlab/prior_posterior_statistics.m +++ b/matlab/prior_posterior_statistics.m @@ -354,7 +354,7 @@ if options_.smoother if nvn for obs_iter=1:length(options_.varobs) meas_error_names{obs_iter,1}=['SE_EOBS_' M_.endo_names{strmatch(options_.varobs{obs_iter},M_.endo_names,'exact')}]; - texnames{obs_iter,1}=['SE_EOBS_' M_.endo_names_tex{strmatch(options_.varobs{obs_iter},M_.endo_names,'exact')}]; + texnames{obs_iter,1}=['\sigma^{ME}_' M_.endo_names_tex{strmatch(options_.varobs{obs_iter},M_.endo_names,'exact')}]; end pm3(meas_err_nbr,gend,ifil(3),B,'Smoothed measurement errors',... '',meas_error_names,texnames,meas_error_names,... diff --git a/matlab/rplot.m b/matlab/rplot.m index 76a606d1a7efdf9183ce7be4da74443c172020f9..0f49ca29a354aa1d30c1f1de877e688a925f86fb 100644 --- a/matlab/rplot.m +++ b/matlab/rplot.m @@ -54,9 +54,11 @@ for k = 1:length(s1) error ('rplot: One of the variables specified does not exist') ; else y = [y; oo_.exo_simul(:, strcmp(s1{k}, M_.exo_names))'] ; + s1_TeX(k,1)=M_.exo_names_tex(strcmp(s1{k}, M_.exo_names)); end else y = [y; oo_.endo_simul(strcmp(s1{k}, M_.endo_names), :)]; + s1_TeX(k,1)=M_.endo_names_tex(strcmp(s1{k}, M_.endo_names)); end end @@ -75,15 +77,21 @@ end if options_.rplottype == 0 hh=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory'); plot(ix(i),y(:,i)) ; - title (['Plot of ' strjoin(s1, ' ')],'Interpreter','none') ; + if options_.TeX + title (['Plot of $' strjoin(s1_TeX, '~') '$'],'Interpreter','latex') ; + else + title (['Plot of ' strjoin(s1, ' ')],'Interpreter','none') ; + end xlabel('Periods') ; xlim([min(ix(i)) max(ix(i))]) if length(s1) > 1 - if isoctave - legend(s1); + if options_.TeX + for k = 1:length(s1) + s1_TeX(k,1)={['$' s1_TeX{k,1} '$']}; + end + legend(s1_TeX,'interpreter','latex'); else - h = legend(s1); - set(h, 'Interpreter', 'none'); + legend(s1,'interpreter','none'); end end dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format) @@ -95,7 +103,11 @@ elseif options_.rplottype == 1 hh=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory'); plot(ix(i),y(j,i)) ; xlim([min(ix(i)) max(ix(i))]) - title(['Plot of ' s1{j}],'Interpreter','none') ; + if options_.TeX + title(['Plot of $' s1_TeX{j} '$'],'Interpreter','latex') ; + else + title(['Plot of ' s1{j}],'Interpreter','none') ; + end xlabel('Periods') ; dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{j}],options_.nodisplay,options_.graph_format) if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format))) @@ -116,8 +128,13 @@ elseif options_.rplottype == 2 plot(ix(i),oo_.exo_steady_state(strcmp(s1{j}, M_.exo_names))*ones(1,size(i,1)),'r:') ; end xlabel('Periods') ; - ylabel([s1{j}],'Interpreter','none') ; - title(['Plot of ' s1{j}],'Interpreter','none') ; + if options_.TeX + ylabel([s1_TeX{j}],'Interpreter','latex') ; + title(['Plot of $' s1_TeX{j} '$'],'Interpreter','latex') ; + else + ylabel([s1{j}],'Interpreter','none') ; + title(['Plot of ' s1{j}],'Interpreter','none') ; + end axis tight; end dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format) diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m index 3418770fd5d42b5fcb635e3710fb73dda7718aed..ac0908de6b8e102249d63dcd30476c8d7f4ea0e2 100644 --- a/matlab/stoch_simul.m +++ b/matlab/stoch_simul.m @@ -292,14 +292,15 @@ if options_.irf hold off xlim([1 options_.irf]); remove_fractional_xticks; - title(deblank(mylist(j,:)),'Interpreter','none'); + if TeX + title(['$' deblank(mylistTeX(j,:)) '$'],'Interpreter','latex'); + else + title(deblank(mylist(j,:)),'Interpreter','none'); + end end 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, '/graphs/' M_.fname],tit{i}); fprintf(fidTeX,'\\caption{Impulse response functions (orthogonalized shock to $%s$).}\n',titTeX{i}); @@ -324,14 +325,15 @@ if options_.irf hold off xlim([1 options_.irf]); remove_fractional_xticks - title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none'); + if TeX + title(['$' deblank(mylistTeX((fig-1)*nstar+plt,:)) '$'],'Interpreter','latex'); + else + title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none'); + end end 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, '/graphs/' M_.fname],tit{i},int2str(fig)); if options_.relative_irf @@ -355,14 +357,15 @@ if options_.irf hold off xlim([1 options_.irf]); remove_fractional_xticks - title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none'); + if TeX + title(['$' deblank(mylistTeX((nbplt-1)*nstar+plt,:)) '$'],'Interpreter','latex'); + else + title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none'); + end end 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, '/graphs/' M_.fname],tit{i},int2str(nbplt)); if options_.relative_irf