From e329ee2b600dece7629e4da8047d600e9cee2301 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Mon, 17 Feb 2014 12:24:22 +0100 Subject: [PATCH] reporting: make the titleFormat default work for both titles and subtitles, not just titles --- doc/dynare.texi | 7 ++++--- matlab/reports/@page/page.m | 8 +++++--- matlab/reports/@report_table/report_table.m | 8 +++++--- tests/reporting/runDynareReport.m | 1 - 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index 9a911c4ece..d5af326c9b 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -10687,9 +10687,10 @@ of the page. Default: @code{none} @anchor{titleFormat} @item titleFormat, @code{STRING} | @code{CELL_ARRAY_STRINGS} -A string representing the @LaTeX{} markup to use on -@ref{title}. The number of cell array entries must be equal to that of -the @ref{title} option. Default: @code{\large\bfseries} +A string representing the @LaTeX{} markup to use on @ref{title}. The +number of cell array entries must be equal to that of the @ref{title} +option, if you do not want to use the default value for the title and +subtitle(s). Default: @code{\large\bfseries} @end table @end defmethod diff --git a/matlab/reports/@page/page.m b/matlab/reports/@page/page.m index 28c1f80009..7bcc26c5d7 100644 --- a/matlab/reports/@page/page.m +++ b/matlab/reports/@page/page.m @@ -32,7 +32,8 @@ function o = page(varargin) o = struct; o.paper = ''; o.title = {''}; -o.titleFormat = {'\large\bfseries'}; +titleFormatDefalut = {'\large\bfseries'}; +o.titleFormat = titleFormatDefalut; o.orientation = ''; o.footnote = {}; o.sections = {}; @@ -69,12 +70,13 @@ end if ischar(o.titleFormat) o.titleFormat = {o.titleFormat}; end +if length(o.title) ~= length(o.titleFormat) + o.titleFormat = repmat(titleFormatDefalut, 1, length(o.title)); +end assert(iscellstr(o.title), ... '@page.page: title must be a cell array of strings'); assert(iscellstr(o.titleFormat), ... '@page.page: titleFormat must be a cell array of strings'); -assert(length(o.title)==length(o.titleFormat), ... - '@page.page: title and titleFormat must be of the same length'); valid_paper = {'a4', 'letter'}; assert(any(strcmp(o.paper, valid_paper)), ... diff --git a/matlab/reports/@report_table/report_table.m b/matlab/reports/@report_table/report_table.m index 12df17010f..79e77cdc53 100644 --- a/matlab/reports/@report_table/report_table.m +++ b/matlab/reports/@report_table/report_table.m @@ -34,7 +34,8 @@ o = struct; o.series = {}; o.title = {''}; -o.titleFormat = {'\large'}; +titleFormatDefalut = {'\large'}; +o.titleFormat = titleFormatDefalut; o.showHlines = false; o.showVlines = false; @@ -85,6 +86,9 @@ end if ischar(o.titleFormat) o.titleFormat = {o.titleFormat}; end +if length(o.title) ~= length(o.titleFormat) + o.titleFormat = repmat(titleFormatDefalut, 1, length(o.title)); +end assert(islogical(o.showHlines), '@report_table.report_table: showHlines must be true or false'); assert(islogical(o.showVlines), '@report_table.report_table: showVlines must be true or false'); assert(isint(o.precision), '@report_table.report_table: precision must be an int'); @@ -106,8 +110,6 @@ assert(iscellstr(o.title), ... '@report_table.report_table: title must be a cell array of string(s)'); assert(iscellstr(o.titleFormat), ... '@report_table.report_table: titleFormat must be a cell array of string(s)'); -assert(length(o.title) == length(o.titleFormat), ... - '@report_table.report_table: title and titleFormat must have the same length'); % using o.seriesToUse, create series objects and put them in o.series if ~isempty(o.data) diff --git a/tests/reporting/runDynareReport.m b/tests/reporting/runDynareReport.m index d7b5e67bc5..7ae2f11246 100644 --- a/tests/reporting/runDynareReport.m +++ b/tests/reporting/runDynareReport.m @@ -43,7 +43,6 @@ rep = rep.addVspace(); % Table 1 rep = rep.addTable('title', {'Real GDP Growth','subtitle 1', 'subtitle 2'}, ... - 'titleFormat', {'\large\bfseries','\small\bfseries','\tiny'}, ... 'range', larange, ... 'vlineAfter', dates('2011y')); rep = AnnualTable(rep, db_a, dc_a, 'PCH_GROWTH4_', larange); -- GitLab