[LaTeX] Codice colorato (Fenomenale listings!!)

Manuel Toniato manuel17@libero.it
Fri May 28 13:13:44 CEST 2004


Grazissime a chi mi ha consigliato il pacchetto listings. È proprio fenomenale!
Mi da però 4 errori dovuti al mio codice:

------------------------------------------------------
! Extra \fi.
\lst@AppendLetter ... \lst@lettertrue \fi 
                                          \lst@Append 
l.67 	if length(B)~=l
                     ength(A)
I'm ignoring this; it doesn't match any \if.

! Extra \fi.
\lst@PrintToken ...@lastother \@empty \fi 
                                          
l.89 	Ik=(Bk/Ak)^2;
                   
I'm ignoring this; it doesn't match any \if.

! Extra \fi.
\lst@AppendLetter ... \lst@lettertrue \fi 
                                          \lst@Append 
l.91 	    Ik=beta(i)^2+I
                        k*(1-alpha(i)^2);
I'm ignoring this; it doesn't match any \if.

! Extra \fi.
\lst@PrintToken ...@lastother \@empty \fi 
                                          
l.91 	    Ik=beta(i)^2+Ik*(1-alpha(i)^2);
                                         
I'm ignoring this; it doesn't match any \if.
------------------------------------------------------

Il codice in questione è questo (non guardate all'inefficienza o alle schifezze di programmazione):

function s=astrom(B,A)
	if length(B)~=length(A)
	    return
	end

	n=length(B);
	Ak=A;
	Bk=B;
	
	%Calcolo dei coefficienti alpha e beta
	for i=1:n-1
	    alpha(i)=Ak(end)/Ak(1);
	    beta(i)=Bk(end)/Ak(1);
	    Bk=Bk-beta(i)*fliplr(Ak);
	    Ak=Ak-alpha(i)*fliplr(Ak);
	    Ak=Ak(1:end-1);
	    Bk=Bk(1:end-1);
	end
	
	alpha=fliplr(alpha);
	beta=fliplr(beta);
	
	%Calcolo degli integrali Ik
	Ik=(Bk/Ak)^2;
	for i=1:n-1
	    Ik=beta(i)^2+Ik*(1-alpha(i)^2);
	end
	s=Ik;

Cosa devo fare perché Latex non mi dia problemi??

A parte questa cosa ho settato il listings così:
\lstset{
	language=Matlab,
	basicstyle=\ttfamily,
	flexiblecolumns=true,
	keywordstyle=\color{blue},
	commentstyle=\color{red},
	deletekeywords={beta}
	}


Grazieee!
Manuel

Il 28/05/2004 alle 12.47 Giacomo Sacchetti <virusse@email.it> ha scritto:
 
       "Re: [LaTeX] Codice colorato"






More information about the latex mailing list