File mttroot/mtt/bin/trans/ode_r2tex artifact d72a266090 part of check-in bca1a038ac


#! /bin/sh

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

# Bourne shell script: ode_r2tex
# Reduce differential-algebraic to LaTex differential-algebraic equations.
# P.J.Gawthrop 10th May 1991, April 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/01/23 15:51:01  peterg
## Repleace eqnarray by equation + aligned -- this works with Latex2html
##
## Revision 1.2  1996/12/20 08:59:10  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/12/20 08:53:57  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_ode.tex

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

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

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

%Read the differential-algebraic equations file
in "$1_ode.r";

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



OFF Echo;
OFF Nat;

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

%Read the simplifying expressions file
IN "$1_simp.r";

OUT "$1_ode.tex";

%Write out the  differential-algebraic equations.

write "%File: $1_ode.tex";

write "%ordinary differential equations";
write "% Generated by MTT";

IF MTTNx>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_x}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNx DO
  BEGIN
	write "\dot MTTX", Row, " &= ";
	write "{";
	write MTTdx(Row,1);
	write "}";
        IF Row<MTTNx THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNyz>0 THEN
BEGIN
  write"\begin{equation}";
  write"\begin{aligned}";
FOR Row := 1:MTTNyz DO
  BEGIN
	write "0 &= ";
	write "{";
	write MTTyz(Row,1);
	write "}";
        IF Row<MTTNyz THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNy>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_y}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNy DO
  BEGIN
	write "MTTy", Row, " &= ";
	write "{";
	write MTTy(Row,1);
	write "}";
        IF Row<MTTNy THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;





SHUT "$1_ode.tex";
quit;
EOF


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