diff --git a/src/@page/page.m b/src/@page/page.m index 290d9caaa9cd45ad2a85079f7a5b8514507427dc..9d4271a11ae26cf97a41fd5d0ef4cf0d6e5fa3a8 100644 --- a/src/@page/page.m +++ b/src/@page/page.m @@ -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, ' ')]); diff --git a/src/@page/write.m b/src/@page/write.m index 6a66fd69a05103d1aa21ef59f18dae82e6dbe385..95f957b4ca74d7a7d4f09373e4a4ec5eb12fcdf7 100644 --- a/src/@page/write.m +++ b/src/@page/write.m @@ -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