File mttroot/mtt/bin/trans/sympar_txt2tex artifact 9ce2cbef3d part of check-in e7609f6ad9


#! /bin/sh

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

# Bourne shell script: sympar_txt2tex

# Sympar file - text to TeX table conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/01/19 14:17:26  peterg
## Modified struc_txt2tex to make this.
##
## Revision 1.1  1998/01/19 14:16:39  peterg
## Initial revision
##
# Revision 1.3  1997/12/06  19:10:41  peterg
# Reverted to tabular --- from supertabular
#
# Revision 1.2  1997/04/15  11:17:58  peterg
# Uses supertabular for long tables.
#
# Revision 1.1  1997/04/15  09:49:04  peterg
# Initial revision
#
###############################################################


# Inform user
echo "Creating $1_sympar.tex"

rm -f mtt_error

#Write some file headers
echo "%% Parameter file ($1_sympar.txt)" > $1_sympar.tex
echo "%% Generated by MTT at `date`" >> $1_sympar.tex

# This is the main transformation using awk
sed 's/_/\\_/g' < $1_sympar.txt |  awk '
#function header(what){
#  print "  \\centering";
# print "  \\tablefirsthead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tablehead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM " (continued)} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tabletail{\\hline}";
#  print "  \\begin{supertabular}{|l|l|l|l|}";
#}
function header(what){
  print "\\begin{table}[htbp]";
  print "  \\centering";
  print "  \\begin{tabular}{|l|l|}";  print "    \\hline";
  print "     Parameter & System\\\\";
  print "    \\hline";
}
function footer(what){
  print "    \\hline";
  print "  \\end{tabular}";
  print "  \\caption{" what "}";
  print "\\end{table}";
  print "   \\bigskip";
  print "   \\bigskip";
}
BEGIN{
  header($1);
}
{
  print $1, "&", $2, "\\\\";
}
END{
  footer("Parameters")
}
'  SYSTEM=$1  >> $1_sympar.tex 2>mtt_error.txt

# Now invoke the standard error handling.
mtt_error mtt_error.txt




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