diff --git a/doc/dynare.texi b/doc/dynare.texi index 575b5acda42e44f9e4c1e9af050c08f432f7f517..3efb9e73921cab54d1b7e52768a0fa708ae2e031 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -11199,7 +11199,7 @@ used. Below, you will see a list of methods available for the Report class and a clarifying example. -@defmethod Report report compiler, showDate, fileName, margin, marginUnit, orientation, paper, title +@defmethod Report report compiler, showDate, fileName, margin, marginUnit, orientation, paper, showOutput, title Instantiates a @code{Report} object. @optionshead @table @code @@ -11234,6 +11234,12 @@ Paper orientation: Default: @code{`portrait'} @item paper, `a4' | `letter' Paper size. Default: @code{`a4'} +@anchor{showOutput} +@item showOutput, @code{BOOLEAN} +Print report creation progress to screen. Shows you the page number as it is +created and as it is written. This is useful to see where a potential error +occurs in report creation. Default: @code{true} + @item title, @code{STRING} Report Title. Default: @code{none} @end table @@ -11677,7 +11683,8 @@ for passing the value at the last minute. @item showOutput, @code{BOOLEAN} Print the compiler output to the screen. Useful for debugging your code as the -@LaTeX{} compiler hangs if there is a problem. Default: @code{true} +@LaTeX{} compiler hangs if there is a problem. Default: the value of +@ref{showOutput} @item showReport, @code{BOOLEAN} Open the compiled report (works on Windows and OS X on Matlab). Default: diff --git a/matlab/reports/@report/addPage.m b/matlab/reports/@report/addPage.m index c44cbf2333d644769c0f449e86a52d5c79b15713..0fd7aa48176ddd79aad8d8c6e73d8dcc10b3a854 100644 --- a/matlab/reports/@report/addPage.m +++ b/matlab/reports/@report/addPage.m @@ -30,6 +30,8 @@ function o = addPage(o, varargin) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. np = length(o.pages) + 1; -fprintf(1, 'Adding Page: %d\n', np); +if o.showOutput + fprintf(1, 'Adding Page: %d\n', np); +end o.pages{np} = page('orientation', o.orientation, 'paper', o.paper, varargin{:}); end diff --git a/matlab/reports/@report/compile.m b/matlab/reports/@report/compile.m index 086592ac97db8d6d74067eda0b5861dccab7f921..3b3077b587d2b016d7cc04c2b63bad8c19bbf73b 100644 --- a/matlab/reports/@report/compile.m +++ b/matlab/reports/@report/compile.m @@ -32,7 +32,7 @@ function o = compile(o, varargin) opts.compiler = o.compiler; opts.showReport = true; -opts.showOutput = true; +opts.showOutput = o.showOutput; if nargin > 1 if round((nargin-1)/2) ~= (nargin-1)/2 @@ -71,15 +71,28 @@ end if isempty(opts.compiler) if strncmp(computer, 'MACI', 4) || ~isempty(regexpi(computer, '.*apple.*', 'once')) % Add most likely places for pdflatex to exist outside of default $PATH - [status, opts.compiler] = ... - system(['PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;' ... - 'which pdflatex'], echo); + if opts.showOutput + [status, opts.compiler] = ... + system(['PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;' ... + 'which pdflatex'], echo); + else + [status, opts.compiler] = ... + system('PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;which pdflatex'); + end elseif strcmp(computer, 'PCWIN') || strcmp(computer, 'PCWIN64') - [status, opts.compiler] = system('findtexmf --file-type=exe pdflatex', echo); + if opts.showOutput + [status, opts.compiler] = system('findtexmf --file-type=exe pdflatex', echo); + else + [status, opts.compiler] = system('findtexmf --file-type=exe pdflatex'); + end middle = ' '; opts.compiler = ['"' strtrim(opts.compiler) '"']; else % gnu/linux - [status, opts.compiler] = system('which pdflatex', echo); + if opts.showOutput + [status, opts.compiler] = system('which pdflatex', echo); + else + [status, opts.compiler] = system('which pdflatex'); + end end assert(status == 0, ... '@report.compile: Could not find a tex compiler on your system'); @@ -98,10 +111,11 @@ if status ~= 0 error(['@report.compile: There was an error in compiling ' rfn '.pdf.' ... ' ' compiler ' returned the error code: ' num2str(status)]); end -fprintf(1, '\n\nDone.\n'); -disp('Your compiled report is located here:'); -disp([' ' pwd filesep rfn '.pdf']); - +if o.showOutput || opts.showOutput + fprintf(1, 'Done.\n'); + disp('Your compiled report is located here:'); + disp([' ' pwd filesep rfn '.pdf']); +end if opts.showReport && ~isoctave open([pwd filesep rfn '.pdf']); end diff --git a/matlab/reports/@report/report.m b/matlab/reports/@report/report.m index 07340f9c493a7c276e1c2d7e1c2c86461d8fcbca..cf4a6160375dea968ae14b0e1332e293e44f5f25 100644 --- a/matlab/reports/@report/report.m +++ b/matlab/reports/@report/report.m @@ -41,6 +41,7 @@ o.pages = {}; o.fileName = 'report.tex'; o.showDate = true; o.compiler = ''; +o.showOutput = true; if nargin == 1 assert(isa(varargin{1}, 'report'), ['@report.report: with one arg, ' ... @@ -72,6 +73,7 @@ assert(ischar(o.title), '@report.report: title must be a string'); assert(ischar(o.fileName), '@report.report: fileName must be a string'); assert(ischar(o.compiler), '@report.report: compiler file must be a string'); assert(islogical(o.showDate), '@report.report: showDate must be either true or false'); +assert(islogical(o.showOutput), '@report.report: showOutput must be either true or false'); assert(isfloat(o.margin) && o.margin > 0, '@report.report: margin must be a float > 0.'); valid_margin_unit = {'cm', 'in'}; diff --git a/matlab/reports/@report/write.m b/matlab/reports/@report/write.m index 0970f0c9e76e55068c899bac9d779a9ac2bb46ff..fce1a2e7a36d16c7b7484fe70f326104d552a31c 100644 --- a/matlab/reports/@report/write.m +++ b/matlab/reports/@report/write.m @@ -80,7 +80,9 @@ fprintf(fid, '\\centering\n'); nps = length(o.pages); for i=1:nps - fprintf(1, 'Writing Page: %d\n', i); + if o.showOutput + fprintf(1, 'Writing Page: %d\n', i); + end o.pages{i}.write(fid, i); end @@ -90,5 +92,7 @@ status = fclose(fid); if status == -1 error('@report.write: closing %s\n', o.fileName); end -disp('Finished Writing Report!'); +if o.showOutput + disp('Finished Writing Report!'); +end end