diff --git a/matlab/get_prior_info.m b/matlab/get_prior_info.m
index cbae72ed13914f4be1ce885947b706200c0d8674..d2ec1810e1bf3a60336c7df6ce59229f3c219c45 100644
--- a/matlab/get_prior_info.m
+++ b/matlab/get_prior_info.m
@@ -54,13 +54,32 @@ options_.order = 1;
 
 [xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);
 if plt_flag
-    plot_priors(bayestopt_,M_,options_);
+    plot_priors(bayestopt_,M_,estim_params_,options_)
 end
 
 PriorNames = { 'Beta' , 'Gamma' , 'Gaussian' , 'Inverted Gamma' , 'Uniform' , 'Inverted Gamma -- 2' };
 
 if size(M_.param_names,1)==size(M_.param_names_tex,1)% All the parameters have a TeX name.
     fidTeX = fopen('priors_data.tex','w+');
+    fprintf(fidTeX,'%% TeX-table generated by get_prior_info (Dynare).\n');
+    fprintf(fidTeX,'%% Prior Information\n');
+    fprintf(fidTeX,['%% ' datestr(now,0)]);
+    fprintf(fidTeX,' \n');
+    fprintf(fidTeX,' \n');
+    fprintf(fidTeX,'\\begin{center}\n');
+    fprintf(fidTeX,'\\begin{longtable}{l|ccccccc} \n');
+    fprintf(fidTeX,'\\caption{Prior information (parameters)}\\\\\n ');
+    fprintf(fidTeX,'\\label{Table:Prior}\\\\\n');
+    fprintf(fidTeX,'\\hline\\hline \\\\ \n');
+    fprintf(fidTeX,'  & Prior distribution & Prior mean  & Prior s.d. & Lower Bound & Upper Bound & LB Untrunc. 80\\%% HPDI & UB Untrunc. 80\\%% HPDI  \\\\ \n');
+    fprintf(fidTeX,'\\hline \\endfirsthead \n');
+    fprintf(fidTeX,'\\caption{(continued)}\\\\\n ');
+    fprintf(fidTeX,'\\hline\\hline \\\\ \n');
+    fprintf(fidTeX,'  & Prior distribution & Prior mean  & Prior s.d. & Lower Bound & Upper Bound & LB Untrunc.  80\\%% HPDI & UB Untrunc. 80\\%% HPDI  \\\\ \n');
+    fprintf(fidTeX,'\\hline \\endhead \n');
+    fprintf(fidTeX,'\\hline \\multicolumn{8}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
+    fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
+
     % Column 1: a string for the name of the prior distribution.
     % Column 2: the prior mean.
     % Column 3: the prior standard deviation.
@@ -81,24 +100,43 @@ if size(M_.param_names,1)==size(M_.param_names_tex,1)% All the parameters have a
           case { 1 , 5 }
             LowerBound = bayestopt_.p3(i);
             UpperBound = bayestopt_.p4(i);
-          case { 2 , 4 , 6 }
+            if ~isinf(bayestopt_.lb(i))
+                LowerBound=max(LowerBound,bayestopt_.lb(i));
+            end
+            if ~isinf(bayestopt_.ub(i))
+                UpperBound=min(UpperBound,bayestopt_.ub(i));
+            end
+            case { 2 , 4 , 6 }
             LowerBound = bayestopt_.p3(i);
-            UpperBound = '$\infty$';
+            if ~isinf(bayestopt_.lb(i))
+                LowerBound=max(LowerBound,bayestopt_.lb(i));
+            end
+            if ~isinf(bayestopt_.ub(i))
+                UpperBound=bayestopt_.ub(i);
+            else
+                UpperBound = '$\infty$';
+            end
           case 3
-            if isinf(bayestopt_.p3(i))
+            if isinf(bayestopt_.p3(i)) && isinf(bayestopt_.lb(i))
                 LowerBound = '$-\infty$';
             else
                 LowerBound = bayestopt_.p3(i);
+                if ~isinf(bayestopt_.lb(i))
+                    LowerBound=max(LowerBound,bayestopt_.lb(i));
+                end
             end
-            if isinf(bayestopt_.p4(i))
+            if isinf(bayestopt_.p4(i)) && isinf(bayestopt_.ub(i))
                 UpperBound = '$\infty$';
             else
                 UpperBound = bayestopt_.p4(i);
+                if ~isinf(bayestopt_.ub(i))
+                    UpperBound=min(UpperBound,bayestopt_.ub(i));
+                end
             end
           otherwise
             error('get_prior_info:: Dynare bug!')
         end
-        format_string = build_format_string(bayestopt_,i);
+        format_string = build_format_string(PriorStandardDeviation,LowerBound,UpperBound);
         fprintf(fidTeX,format_string, ...
                 TexName, ...
                 PriorShape, ...
@@ -109,6 +147,9 @@ if size(M_.param_names,1)==size(M_.param_names_tex,1)% All the parameters have a
                 PriorIntervals(i,1), ...
                 PriorIntervals(i,2) );
     end
+    fprintf(fidTeX,'\\end{longtable}\n ');    
+    fprintf(fidTeX,'\\end{center}\n');
+    fprintf(fidTeX,'%% End of TeX file.\n');
     fclose(fidTeX);
 end
 
@@ -191,19 +232,19 @@ end
 
 options_.order = order;
 
-function format_string = build_format_string(bayestopt,i)
+function format_string = build_format_string(PriorStandardDeviation,LowerBound,UpperBound)
 format_string = ['%s & %s & %6.4f &'];
-if isinf(bayestopt.p2(i))
+if ~isnumeric(PriorStandardDeviation)
     format_string = [ format_string , ' %s &'];
 else
     format_string = [ format_string , ' %6.4f &'];
 end
-if isinf(bayestopt.p3(i))
+if ~isnumeric(LowerBound)
     format_string = [ format_string , ' %s &'];
 else
     format_string = [ format_string , ' %6.4f &'];
 end
-if isinf(bayestopt.p4(i))
+if ~isnumeric(UpperBound)
     format_string = [ format_string , ' %s &'];
 else
     format_string = [ format_string , ' %6.4f &'];