7 |
% 2 add a figure plus caption (see myFig) |
% 2 add a figure plus caption (see myFig) |
8 |
% 3 add a paragraph |
% 3 add a paragraph |
9 |
% 4 finish file |
% 4 finish file |
10 |
% 5 compile and remove temporary files (incl. *fig*.ps) |
% 5 compile (latex x 2 then dvipdf) |
11 |
% -5 compile solely |
% 6 remove temporary files (incl. *fig*.ps) |
12 |
%optional myText is a cell array of text lines (for myStep=1 to 2) |
%optional myText is a cell array of text lines (for myStep=1 to 2) |
13 |
% myLev is the title level (for myStep=1) |
% myLev is the title level (for myStep=1) |
14 |
% 1=section, 2=subsection (not yet implemented) |
% 1=section, 2=subsection (not yet implemented) |
15 |
% myFig is a figure handle (for myStep=2) |
% myFig is a figure handle (for myStep=2) |
16 |
|
|
17 |
|
if isempty(myFile); |
18 |
|
%if no file name, then do nothing |
19 |
|
return; |
20 |
|
end; |
21 |
|
if iscell(myFile); |
22 |
|
%extecute alternative command (myFile{1}) passing rest as arguments |
23 |
|
eval([myFile{1} '(myFile{2:end});']); |
24 |
|
return; |
25 |
|
end; |
26 |
|
|
27 |
|
|
28 |
myText=[]; myLev=[]; myFig=[]; |
myText=[]; myLev=[]; myFig=[]; |
29 |
if myStep<4; myText=varargin{1}; end; |
if myStep<4; myText=varargin{1}; end; |
30 |
if myStep==1; myLev=varargin{2}; |
if myStep==1; myLev=varargin{2}; |
74 |
%add title or section page (see myLev) |
%add title or section page (see myLev) |
75 |
if myStep==1; |
if myStep==1; |
76 |
mySection=myText; |
mySection=myText; |
77 |
fprintf(fid,'\\section{\n'); |
if myLev==1; fprintf(fid,'\\section{\n'); |
78 |
|
else; fprintf(fid,'\\subsection{\n'); |
79 |
|
end; |
80 |
fprintf(fid,mySection); |
fprintf(fid,mySection); |
81 |
fprintf(fid,'} \n\n'); |
fprintf(fid,'} \n\n'); |
82 |
end; |
end; |
124 |
eval(['save ' myFile(1:end-4) '.mat myFigNumTex mySection;']); |
eval(['save ' myFile(1:end-4) '.mat myFigNumTex mySection;']); |
125 |
|
|
126 |
%compile |
%compile |
127 |
if myStep==5|myStep==-5; |
if myStep==5; |
128 |
dirOrig=pwd; |
dirOrig=pwd; |
129 |
nn=strfind(myFile,'/'); |
nn=strfind(myFile,'/'); |
130 |
if ~isempty(nn); |
if ~isempty(nn); |
131 |
cd(myFile(1:nn)); fileTex=myFile(nn+1:end-4); |
cd(myFile(1:nn(end))); fileTex=myFile(nn(end)+1:end-4); |
132 |
else; |
else; |
133 |
fileTex=myFile(1:end-4); |
fileTex=myFile(1:end-4); |
134 |
end; |
end; |
140 |
|
|
141 |
|
|
142 |
%compile |
%compile |
143 |
if myStep==5; |
if myStep==6; |
144 |
dirOrig=pwd; |
dirOrig=pwd; |
145 |
nn=strfind(myFile,'/'); |
nn=strfind(myFile,'/'); |
146 |
if ~isempty(nn); |
if ~isempty(nn); |
147 |
cd(myFile(1:nn)); fileTex=myFile(nn+1:end-4); |
cd(myFile(1:nn(end))); fileTex=myFile(nn(end)+1:end-4); |
148 |
else; |
else; |
149 |
fileTex=myFile(1:end-4); |
fileTex=myFile(1:end-4); |
150 |
end; |
end; |