generate_sce_tex_file - create main tex file of scilab scripts
txt = generate_sce_tex_file(namef,flag,lang)
- namef : add here the parameter description
- flag : add here the parameter description
- lang : add here the parameter description
- txt : add here the parameter description
//generate_sce_tex_file
//Entrée : namef un vecteur de chaine de caractère
// flag 'html' ou 'guide'
//txt = le texte du fichier .tex principal
function txt=generate_sce_tex_file(namef,flag,lang)
//verify the 'lang' right parameter
[lsh,rsh]=argn(0)
if rsh<3 then
if ~exists('lang') then
lang='eng'
elseif lang<>'eng' & lang<>'fr' then
lang='eng'
end
end
//tt1 : header
//tt2 : library
//tt3 : calling Sequence
//tt4 : parameters
//tt5 : description
//tt6 : example
//tt7 : text of function
//tt8 : used functions
//tt9 : see also
//tt10 : Authors
//tt11 : Bibliography
//tt12 : end of tex file
//define title of paragraph
tt_title=[
'' //tt1 : header du fichier tex
'Description' //tt2 : Description (_long)
'File content' //tt3 : text of funtion
'Used function' //tt4 : Used functions (_used_func)
'See Also' //tt5 : See Also (_see_also)
'Authors' //tt6 : Authors (_authors)
'' //tt7 : Bibliography (_bib)
'' //tt8 : End of tex file
]
//change language of title
if lang=='fr' then
tt_title=change_lang_title(lang,tt_title);
end
//define level of paragraph
if flag=='html' then
tex_title='\subsection{'+tt_title+'}'
else
tex_title='\subsection{'+tt_title+'}'
end
//Generate auxiliary tex files
namef=generate_aux_tex_file(namef,'sce',flag,lang);
for i=1:size(namef,1)
for j=1:8 execstr('tt'+string(j)+'=[]'),end
if fileinfo(namef(i,1)+'_sce/'+namef(i,1)+'_long.tex')<>[] then
tt2=[tex_title(2) //description
''
'\input{'+namef(i,1)+'_long}']
end
tt_rep=return_ext_file(tt_ml,namef(i,1)+'.sce');
if tt_rep<>[] then
if size(tt_rep,1)==1 then
tt3=[tex_title(3) //file content
'{\tiny'
'\verbatiminput{'+tt_rep(1)+tt_rep(2)+'}'
'}']
end
end
if fileinfo(namef(i,1)+'_sce/'+namef(i,1)+'_used_func.tex')<>[] then
tt4=[tex_title(4) //Used function
'\input{'+namef(i,1)+'_used_func}']
end
if fileinfo(namef(i,1)+'_sce/'+namef(i,1)+'_see_also.tex')<>[] then
tt5=[tex_title(5) //See also
'\input{'+namef(i,1)+'_see_also}']
end
if fileinfo(namef(i,1)+'_sce/'+namef(i,1)+'_bib.tex')<>[] then
tt7=['\input{'+namef(i,1)+'_bib.tex}'] //bibliography
end
if flag=='guide' then
//TO BE DONE
tt1=['\section{'+latexsubst(namef(i,1))+'\label{'+namef(i,1)+'}} ';
'\begin{itemize}';]
if lang=='fr' then
tt1=[tt1;'\item \textbf{Description courte:} '+latexsubst(namef(i,2))];
else
tt1=[tt1;'\item \textbf{Short description:} '+latexsubst(namef(i,2))];
end
tt1=[tt1;'\end{itemize}'];
elseif flag=='html' then
if lang=='fr' then //Header of tex file
tt1=['\documentclass[11pt,frenchb]{article}']
else
tt1=['\documentclass[11pt]{article}']
end
tt1=[tt1;
'\usepackage{makeidx,graphics,fullpage}'
'\usepackage{verbatim,times,amsmath,amssymb,epsfig,color}'
'\usepackage{html}'
'\begin{document}']
if lang=='fr' then
tt1=[tt1;'\begin{center}Script Scilab\\']
else
tt1=[tt1;'\begin{center}'+latexsubst(namef(i,3))+'\\']
end
tt1=[tt1
'\htmladdnormallink{eng}{../eng/'+namef(i,1)+'.htm}\hspace{2mm}-'+...
'\hspace{2mm}\htmladdnormallink{fr}{../fr/'+namef(i,1)+'.htm}}'
'\end{center}'];
tt1=[tt1;'\section{\textbf{'+latexsubst(namef(i,1))+...
'} - '+latexsubst(namef(i,2))+'}\label{'+namef(i,1)+'}']
if fileinfo(namef(i,1)+'_sce/'+namef(i,1)+'_authors.tex')<>[] then
tt6=[tex_title(6) //authors
'\input{'+namef(i,1)+'_authors}']
end
tt8=['\htmlinfo*';'\end{document}']
end
txt=[];
for j=1:8 txt=[txt;evstr('tt'+string(j))], end;
mputl(txt,namef(i,1)+'_sce/'+namef(i,1)+'.tex');
end
endfunction
IRCOM Group
Alan Layec