Commit 18de5a2b authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: add latex option to page class

parent 12d9ea21
......@@ -38,6 +38,7 @@ o.titleTruncate = '';
o.orientation = '';
o.footnote = {};
o.sections = {};
o.latex = '';
if nargin == 1
assert(isa(varargin{1}, 'page'), ['@page.page: with one arg to Page ' ...
......@@ -80,8 +81,9 @@ assert(iscellstr(o.titleFormat), ...
'@page.page: titleFormat must be a cell array of strings');
assert((ischar(o.titleTruncate) && isempty(o.titleTruncate)) || ...
isint(o.titleTruncate), ...
'@page.page: titleTruncate must be empty or an integer.');
'@page.page: titleTruncate must be empty or an integer.');
assert(ischar(o.latex), ...
'@page.page: latex must be a string');
valid_paper = {'a4', 'letter'};
assert(any(strcmp(o.paper, valid_paper)), ...
['@page.page: paper must be one of ' strjoin(valid_paper, ' ')]);
......
......@@ -42,22 +42,26 @@ for i=1:length(o.footnote)
end
fprintf(fid,'\n');
fprintf(fid, '\\begin{tabular}[t]{c}\n');
for i=1:length(o.title)
if isint(o.titleTruncate)
if length(o.title{i}) > o.titleTruncate
o.title{i} = o.title{i}(1:o.titleTruncate);
if ~isempty(o.latex)
fprintf(fid, '%s', o.latex);
else
fprintf(fid, '\\begin{tabular}[t]{c}\n');
for i=1:length(o.title)
if isint(o.titleTruncate)
if length(o.title{i}) > o.titleTruncate
o.title{i} = o.title{i}(1:o.titleTruncate);
end
end
fprintf(fid,'\\multicolumn{1}{c}{%s %s}\\\\\n', o.titleFormat{i}, o.title{i});
end
fprintf(fid,'\\multicolumn{1}{c}{%s %s}\\\\\n', o.titleFormat{i}, o.title{i});
end
nps = length(o.sections);
for i=1:nps
o.sections{i}.write(fid, pg, i);
nps = length(o.sections);
for i=1:nps
o.sections{i}.write(fid, pg, i);
end
fprintf(fid, '\\end{tabular}\n');
end
fprintf(fid, '\\end{tabular}\n');
if strcmpi(o.orientation, 'landscape')
fprintf(fid, '\\end{landscape}\n');
end
......
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