File mttroot/mtt/bin/trans/cse_r2tex artifact b46ed08c0b part of check-in 33407c7629


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse_r2tex
# Reduce constrained-state to LaTex constrained-state equations.
# P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Jan 1995
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1999/11/22 23:44:47  peterg
## Now does scse as well
##
## Revision 1.4  1999/11/22 23:04:08  peterg
## *** empty log message ***
##
# Revision 1.3  1996/11/12  09:53:59  peterg
# Reads in the params.r file now.
#
# Revision 1.2  1996/11/12  09:11:20  peterg
# Removed all the hoorrible name changes
#
# Revision 1.1  1996/11/05  09:19:28  peterg
# Initial revision
#
###############################################################

#Inform user
echo Creating $1_$2.tex

# Remove the old log file
rm -f cse_r2tex.log

# Use reduce to accomplish the transformation
reduce >cse_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the parameter file
in "$1_params.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the constrained-state equations file
in "$1_$2.r";

OFF Echo;
OFF Nat;

OUT "$1_$2.tex";

%Write out the  constrained-state equations.

write "%File: $1_$2.tex";

write "%constrained-state equations";
	IF MTTNx>0 THEN
	FOR Row := 1:MTTNx DO
	BEGIN
	        write"\begin{equation}";
		write "\dot MTTEX", Row, " = ";
		write "{";
		write MTTEdX(Row,1);
		write "}";
		write"\end{equation}";
	END;



	IF MTTNy>0 THEN
	FOR Row := 1:MTTNy DO
	BEGIN
		write"\begin{equation}";
		write "MTTy", Row, " = ";
		write "{";
		write MTTy(Row,1);
		write "}";
		write"\end{equation}";
	END;


IF MTTNx NEQ 0 THEN
BEGIN
write "%  - E matrix";
write "\begin{equation}";
write "MTTE = \begin{pmatrix}";
	FOR Row := 1:MTTNx DO
	BEGIN
		FOR Col := 1:MTTNx DO
		BEGIN
			Write "{", MTTE(Row,Col), "}";
			IF Col<MTTNx THEN Write "&"
		END;

	IF Row<MTTNx THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;



%write "%  - E matrix";
%write "\begin{eqnarray}";
%	FOR Row := 1:MTTNx DO
%	BEGIN
%	  FOR Col := 1:MTTNx DO %IF MTTE(Row,Col) NEQ 0 THEN
%	  BEGIN
%	      Write "MTTE", Row, Col, " &=& {", MTTE(Row,Col), "}";
% 	      IF Row<MTTNx OR Col<MTTNx THEN Write "\cr";
%	  END;   
%	END;
%write "\end{eqnarray}";


SHUT "$1_$2.tex";
quit;
EOF


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]