reporting: make the titleFormat default work for both titles and subtitles, not just titles
parent
28716ed52a
commit
e329ee2b60
|
@ -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
|
||||
|
|
|
@ -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)), ...
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue