Code covered by the BSD License  

Highlights from
publish2latex

image thumbnail

publish2latex

by

 

09 Apr 2013 (Updated )

Using full Latex markup in m-files to generate high quality documentation. Version 1.3

runLatex( fObj )
function runLatex( fObj )
%
% Purpose : This file runs the latex environment to generate all the files
% required up to the PDF final result. This is programmed for Windows
%
% Use (syntax): runLatex( fObj )
%
% Input Parameters :
%   fObj: is the object containing all the file information and contents
%
% Return Parameters :
%
% Description and algorithms:
%
% This procedure runns
%   Latex, Bibtex Latex
%
% Then a PS file is generated form the DVI and then a PDF from the PS file.
%
%
% References : 
%
% Author :  Matther Harker and Paul O'Leary
% Date :    29. Jan 2013
% Version : 1.0
%
% (c) 2013 Matther Harker and Paul O'Leary
% url: www.harkeroleary.org
% email: office@harkeroleary.org
%
% History:
%   Date:           Comment:
%
temp = cd;
cd(fObj.resultLatexPath);
%
disp('------------');
disp('Latex run 1');
latexPart1 = 'latex -interaction=nonstopmode ';
%latexPart2 = [' -output-directory=',fObj.resultLatexPath];
latexPart2 = '';
latexPart3 = [' ',fObj.resultLatexName];
%
[status,result] = system([latexPart1,latexPart2,latexPart3]);
% 
%Bibtex
%
disp('Bibtex');
bibPart1 = ['bibtex '];
bibPart2 = [fObj.publishName];
[status,result] = system([bibPart1,bibPart2]);
%
% Latex a second time
%
disp('Latex run 2');
[status,result] = system([latexPart1,latexPart2,latexPart3]);
%
% bibtex time 2
%
disp('Bibtex run 2');
[status,result] = system([bibPart1,bibPart2]);
%
% Latex a third time
%
disp('------------');
disp('Latex run 3');
disp('------------');

system([latexPart1,latexPart2,latexPart3]);
% 
disp('------------');
disp('DVI -> PS');
disp('------------');
part1 = ['dvips -R2 -Ppdf -o ' ];
part2 = [fObj.publishName, '.ps '];
part3 = [fObj.publishName, '.dvi '];
stringAll = [part1, part2, part3];
system(stringAll); 
%
% convert ps to pdf
%
disp('------------');
disp('PS -> PDF');
disp('------------');
part1 = ['ps2pdf14 ', part2];
try
    system(part1);
catch
    error('Please close the PDF file');
end;
%
part1 = [fObj.publishName, '.pdf'];
system( part1 );
%
cd(temp);

Contact us