generate_pals_tex_file - create main tex file of palette
txt = generate_pals_tex_file(PalName,flag,lang)
- PalName : string. name of the palette
- flag : string. set the type of tex files to produce
- 'html' : to produce tex file for html format
- 'guide' : to produce tex file for paper format
- lang : string. set the lang of tex file
- 'eng' : to produce english man page
- 'fr' : to produce french man page
- txt : vector of strings. the output text of the tex file
//generate_pals_tex_file
//
//Fonction qui genere le fichier tex principal
//d'une palette scicos
//Entrée : PalName : Nom de la palette
// flag : 'html' pour générer une page d'aide html
// 'guide' pour générer un page d'aide ps
// lang : 'eng pour de l'anglais (default)
// 'fr' pour du français
function txt=generate_pals_tex_file(PalName,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
//Generate auxiliary tex files
PalName=generate_aux_tex_file(PalName,'pal',flag,lang);
//define title of paragraph
tt_title=[
'' //tt1 : header du fichier tex
'' //tt2 : figure de la palette (.eps)
'Package' //tt3 : Package
'Description' //tt4 : Description (_long)
'Blocks' //tt5 : block contents
'See Also' //tt6 : See Also (_see_also)
'Authors' //tt7 : Authors (_authors)
'' //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
for i=1:size(PalName,1) //for each file
for j=1:8 execstr('tt'+string(j)+'=[]'),end //for each paragraph
if fileinfo(PalName(i,1)+'_cosf/'+PalName(i,1)+'_pals.tex')<>[] then //figure of palette
tt2=['\input{'+PalName(i,1)+'_pals}']
end
if fileinfo(PalName(i,1)+'_cosf/'+PalName(i,1)+'_long.tex')<>[] then //Description
tt4=[tex_title(4)
''
'\input{'+PalName(i,1)+'_long}']
end
if fileinfo(PalName(i,1)+'_cosf/'+PalName(i,1)+'_see_also.tex')<>[] then //see also
tt6=[tex_title(6)
'\input{'+PalName(i,1)+'_see_also}']
end
if flag=='guide' then
tt1=['\chapter{'+PalName(i,2)+'}\label{'+PalName(i,1)+'}'] //Header of tex file
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}Palette Scicos\\']
else
tt1=[tt1;'\begin{center}'+PalName(i,3)+'\\']
end
tt1=[tt1
'\htmladdnormallink{eng}{../eng/'+PalName(i,1)+'.htm}\hspace{2mm}-'+...
'\hspace{2mm}\htmladdnormallink{fr}{../fr/'+PalName(i,1)+'.htm}}'
'\end{center}'];
tt1=[tt1;'\section{'+PalName(i,2)+'}\label{'+PalName(i,1)+'}']
tt3=[tex_title(3) //Package
'\begin{itemize}'
'\item{\htmladdnormallink{Mod\_Num}{whatis.htm}}'
'\end{itemize}']
if fileinfo(PalName(i,1)+'_cosf/'+PalName(i,1)+'_blocks.tex')<>[] then //blocks
tt5=[tex_title(5)
'\input{'+PalName(i,1)+'_blocks}']
end
if fileinfo(PalName(i,1)+'_cosf/'+PalName(i,1)+'_authors.tex')<>[] then //authors
tt7=[tex_title(7)
'\input{'+PalName(i,1)+'_authors}']
end
tt8=['\htmlinfo*';'\end{document}']
end
//Generate the main tex file of block
txt=[]
for j=1:8 txt=[txt;evstr('tt'+string(j))], end
mputl(txt,PalName(i,1)+'_cosf/'+PalName(i,1)+'.tex')
end
endfunction
IRCOM Group
Alan Layec