From d78e491278c531fa66e661cb2488eab2bd90147f Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Wed, 3 Apr 2013 16:28:17 +0200
Subject: [PATCH] reporting: @series: add align_right option

---
 matlab/reporting/@series/series.m | 2 ++
 matlab/reporting/@series/write.m  | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/matlab/reporting/@series/series.m b/matlab/reporting/@series/series.m
index 0be99a830f..95f48562b2 100644
--- a/matlab/reporting/@series/series.m
+++ b/matlab/reporting/@series/series.m
@@ -48,6 +48,8 @@ o.table_markers = false;
 o.table_neg_color = 'red';
 o.table_pos_color = 'blue';
 
+o.table_align_right = false;
+
 if nargin == 1
     assert(isa(varargin{1}, 'series'),['@series.series: with one arg you ' ...
                         'must pass a series object']);
diff --git a/matlab/reporting/@series/write.m b/matlab/reporting/@series/write.m
index 5ef2082dcf..e0bdd287a8 100644
--- a/matlab/reporting/@series/write.m
+++ b/matlab/reporting/@series/write.m
@@ -42,13 +42,20 @@ assert(ischar(o.color), '@series.write: color must be a string');
 assert(ischar(o.table_neg_color), '@series.write: table_neg_color must be a string');
 assert(ischar(o.table_pos_color), '@series.write: table_pos_color must be a string');
 assert(islogical(o.table_markers), '@series.write: table_markers must be a string');
+assert(islogical(o.table_align_right), '@series.write: table_align_right must be a string');
 
 %% Write Output
 dataString = ['%.' num2str(precision) 'f'];
 precision  = 10^precision;
 
 fprintf(fid, '%% Table Row (series)\n');
+if o.table_align_right
+    fprintf(fid, '\\multicolumn{1}{r}{');
+end
 fprintf(fid, '%s', o.data.name{:});
+if o.table_align_right
+    fprintf(fid, '}');
+end
 data = o.data(dates);
 data = data.data;
 for i=1:size(data,1)
-- 
GitLab