diff --git a/doc/dynare.texi b/doc/dynare.texi index c99e583b3..280695f76 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -8421,7 +8421,7 @@ Display a solid black line at @math{y = 0}. Default: @code{false} @end table @end defmethod -@defmethod Report addTable data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, showVlines +@defmethod Report addTable data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines Adds a @code{Table} to a @code{Section}. @optionshead @table @code @@ -8450,6 +8450,10 @@ Title for the table. Default: @code{none} @item vlineAfter, @code{dynDate} Show a vertical line after the specified date. Default: @code{empty} +@item vlineAfterEndOfPeriod, @code{BOOLEAN} +Show a vertical line after the end of every period (@i{i.e.} after +every year, after the fourth quarter, etc.). Default: @code{false} + @item showVlines, @code{BOOLEAN} Whether or not to show vertical lines separating the columns. Default: @code{false} @end table diff --git a/matlab/reports/@table/table.m b/matlab/reports/@table/table.m index 55cdde174..ce3808eeb 100644 --- a/matlab/reports/@table/table.m +++ b/matlab/reports/@table/table.m @@ -39,6 +39,7 @@ o.titleSize = 'large'; o.showHlines = false; o.showVlines = false; o.vlineAfter = ''; +o.vlineAfterEndOfPeriod = false; o.data = ''; o.seriesToUse = ''; @@ -87,6 +88,8 @@ assert(isempty(o.vlineAfter) || isa(o.vlineAfter, 'dynDate'), ... if o.showVlines o.vlineAfter = ''; end +assert(islogical(o.vlineAfterEndOfPeriod), ... + '@table.table: vlineAfterEndOfPeriod must be true or false'); valid_title_sizes = {'Huge', 'huge', 'LARGE', 'Large', 'large', 'normalsize', ... 'small', 'footnotesize', 'scriptsize', 'tiny'}; assert(any(strcmp(o.titleSize, valid_title_sizes)), ... diff --git a/matlab/reports/@table/write.m b/matlab/reports/@table/write.m index afb47f16b..82ba6233f 100644 --- a/matlab/reports/@table/write.m +++ b/matlab/reports/@table/write.m @@ -55,12 +55,20 @@ fprintf(fid, '\\begin{tabular}{@{}l'); for i=1:ndates if o.showVlines - fprintf(fid, '|'); - end - fprintf(fid, 'r'); - if ~isempty(o.vlineAfter) - if dates(i) == o.vlineAfter - fprintf(fid, '|'); + fprintf(fid, 'r|'); + else + fprintf(fid, 'r'); + if o.vlineAfterEndOfPeriod + if dates(i).time(2) == dates(i).freq + fprintf(fid, '|'); + end + end + if ~isempty(o.vlineAfter) + if dates(i) == o.vlineAfter + if ~(o.vlineAfterEndOfPeriod && dates(i).time(2) == dates(i).freq) + fprintf(fid, '|'); + end + end end end end