allow user to set page number. closes #14

remove-priordens
Houtan Bastani 2019-11-06 11:49:30 -05:00
parent 6fe23556f6
commit 87f815d701
3 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,7 @@ classdef page < handle
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.
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
methods
function o = page(varargin)
@ -111,6 +112,8 @@ classdef page < handle
'@page.page: footnote must be a cell array of string(s)');
assert(isempty(o.sections), ...
'@page.page: sections is not a valid option');
assert(isempty(o.setPageNumber) || isint(o.setPageNumber), ...
'@page.page: setPageNumber must be an integer');
end
end
methods (Hidden = true)

View File

@ -32,6 +32,9 @@ function write(o, fid, pg, rep_dir)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
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')
fprintf(fid, '\\begin{landscape}\n');
end

View File

@ -200,7 +200,8 @@ rep.addSeries('graphVline', dates('2009q2'), ...
% Page 25
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.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, ...