when latex option is passed, write page to its own file and include it in the report

remove-priordens
Houtan Bastani 2015-07-08 11:20:44 +02:00
parent cb2571b158
commit 2cb0bc27dc
2 changed files with 16 additions and 1 deletions

View File

@ -38,6 +38,8 @@ o.titleTruncate = '';
o.orientation = '';
o.footnote = {};
o.sections = {};
o.pageDirName = 'tmpRepDir';
o.latex = '';
if nargin == 1
@ -82,6 +84,7 @@ assert(iscellstr(o.titleFormat), ...
assert((ischar(o.titleTruncate) && isempty(o.titleTruncate)) || ...
isint(o.titleTruncate), ...
'@page.page: titleTruncate must be empty or an integer.');
assert(ischar(o.pageDirName), '@page.page: pageDirName must be a string');
assert(ischar(o.latex), ...
'@page.page: latex must be a string');
valid_paper = {'a4', 'letter'};

View File

@ -43,7 +43,19 @@ end
fprintf(fid,'\n');
if ~isempty(o.latex)
fprintf(fid, '%s', o.latex);
if ~exist(o.pageDirName, 'dir')
mkdir(o.pageDirName)
end
pagename = [o.pageDirName filesep 'page_' num2str(pg) '.tex'];
[fidp, msg] = fopen(pagename, 'w');
if fidp == -1
error(['@page.write: ' msg]);
end
fprintf(fidp, '%s', o.latex);
if fclose(fidp) == -1
error('@page.write: closing %s\n', pagename);
end
fprintf(fid, '\\input{%s}', pagename);
else
fprintf(fid, '\\begin{tabular}[t]{c}\n');
for i=1:length(o.title)