write.m 1.53 KB
Newer Older
1 2
function write(o, fid)
%function write(o, fid)
3 4 5 6 7 8 9 10 11 12 13 14
% Write Paragraph object
%
% INPUTS
%   o         [paragraph] paragraph object
%   fid       [integer] file id
%
% OUTPUTS
%   o         [paragraph] paragraph object
%
% SPECIAL REQUIREMENTS
%   none

15
% Copyright (C) 2014-2019 Dynare Team
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

32
fprintf(fid, '%% Paragraph Object written %s\n', datestr(now));
Sébastien Villemot's avatar
Sébastien Villemot committed
33
fprintf(fid, '\\multicolumn{1}{p{\\linewidth}}{%%\n');
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
if o.cols ~= 1
    bc = '';
    if o.balancedCols
        bc = '*';
    end
    fprintf(fid, '\\begin{multicols%s}{%d}%%\n', bc, o.cols);
end

if ~isempty(o.heading)
    if o.cols ~= 1
        fprintf(fid, '[%s\n]\n', o.heading);
    else
        fprintf(fid, '%s\\newline \\newline\n', o.heading);
    end
end

if o.indent
    fprintf(fid, '\\hspace{4ex}');
end

fprintf(fid, '%s', o.text);

if o.cols ~= 1
    fprintf(fid, '\\end{multicols%s}\n', bc);
end
fprintf(fid, '}\n%% End Paragraph Object\n\n');
end