allow user to set page number. closes #14

parent 74ae5c4a
...@@ -32,6 +32,7 @@ classdef page < handle ...@@ -32,6 +32,7 @@ classdef page < handle
footnote = {} % A footnote to be included at the bottom of this page. Default: none. footnote = {} % A footnote to be included at the bottom of this page. Default: none.
pageDirName = 'tmpRepDir' % The name of the folder in which to store this page. Only used when the latex command is passed. Default: tmpRepDir. pageDirName = 'tmpRepDir' % The name of the folder in which to store this page. Only used when the latex command is passed. Default: tmpRepDir.
latex = '' % The valid LATEX code to be used for this page. Alows the user to create a page to be included in the report by passing LATEX code directly. Default: empty. latex = '' % The valid LATEX code to be used for this page. Alows the user to create a page to be included in the report by passing LATEX code directly. Default: empty.
setPageNumber = '' % If true, reset the page number counter. Default: false.
end end
methods methods
function o = page(varargin) function o = page(varargin)
...@@ -111,6 +112,8 @@ classdef page < handle ...@@ -111,6 +112,8 @@ classdef page < handle
'@page.page: footnote must be a cell array of string(s)'); '@page.page: footnote must be a cell array of string(s)');
assert(isempty(o.sections), ... assert(isempty(o.sections), ...
'@page.page: sections is not a valid option'); '@page.page: sections is not a valid option');
assert(isempty(o.setPageNumber) || isint(o.setPageNumber), ...
'@page.page: setPageNumber must be an integer');
end end
end end
methods (Hidden = true) methods (Hidden = true)
......
...@@ -32,6 +32,9 @@ function write(o, fid, pg, rep_dir) ...@@ -32,6 +32,9 @@ function write(o, fid, pg, rep_dir)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
fprintf(fid, '\n%% Page Number %d written %s\n', pg, datestr(now)); fprintf(fid, '\n%% Page Number %d written %s\n', pg, datestr(now));
if ~isempty(o.setPageNumber)
fprintf(fid, '\\setcounter{page}{%d}\n', o.setPageNumber);
end
if strcmpi(o.orientation, 'landscape') if strcmpi(o.orientation, 'landscape')
fprintf(fid, '\\begin{landscape}\n'); fprintf(fid, '\\begin{landscape}\n');
end end
......
...@@ -200,7 +200,8 @@ rep.addSeries('graphVline', dates('2009q2'), ... ...@@ -200,7 +200,8 @@ rep.addSeries('graphVline', dates('2009q2'), ...
% Page 25 % Page 25
rep.addPage('title', {'Jan1 vs Jan2', 'World Oil and Food Prices'}, ... rep.addPage('title', {'Jan1 vs Jan2', 'World Oil and Food Prices'}, ...
'titleFormat', {'\large\bfseries', '\large'}); 'titleFormat', {'\large\bfseries', '\large'}, ...
'setPageNumber', 90);
rep.addSection('cols', 1); rep.addSection('cols', 1);
rep.addParagraph('text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', ... rep.addParagraph('text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', ...
'cols', 2, ... 'cols', 2, ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment