File mttroot/mtt/bin/trans/latex_tidy artifact 0815275655 part of check-in 320b2cf1ce


#! /bin/sh

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

# Bourne shell script: latex_tidy
# Tidies up LaTex format files
# P.J.Gawthrop 12 June 1990, Dec 1994
# Copyright (c) P.J.Gawthrop, 1990, 1994

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  1996/12/31 16:14:53  peterg
## Now handles multi-character subscripts.
##
## Revision 1.7  1996/12/19 10:24:29  peterg
## Uniform conversion of mttxi --> x_{i} for x,u,y and z
## Convert ???mttx to mtt x for  x,u,y and z
##
## Revision 1.6  1996/12/12 16:03:19  peterg
## Removed global argument stuff for y - its already done in the
## translation.
##
## Revision 1.5  1996/12/12 15:59:06  peterg
## Generic handling of subscript for y,u,ui
##
## Revision 1.4  1996/12/12 15:54:20  peterg
## Saved it.
##
## Revision 1.3  1996/08/30 14:36:46  peter
## Added some more subscripts.
## -- its high time this was rewritten in awk or perl!!!
##
## Revision 1.2  1996/08/19 14:35:51  peter
## Prettyfied z dot.
##
## Revision 1.1  1996/08/18 20:03:12  peter
## Initial revision
##
###############################################################
 
cat $1 | \
tr "[A-Z]" "[a-z]" | \
sed \
    -e "s/_\([a-z0-9]*\)/_{\1}/g" \
    -e "s/\// \\\over /g" \
    -e "s/[0-9a-z_]*mtty/mtty/g" \
    -e "s/[0-9a-z_]*mttu/mttu/g" \
    -e "s/mttx\([0-9]*\)/x_{\1}/g" \
    -e "s/mttex\([0-9]*\)/\\\chi_{\1}/g" \
    -e "s/mttui\([0-9]*\)/v_{\1}/g" \
    -e "s/mttu\([0-9]*\)/u_{\1}/g" \
    -e "s/mtty\([0-9]*\)/y_{\1}/g" \
    -e "s/mttz\([0-9]*\)/z_{\1}/g" \
    -e "s/mttdx/\\\dot x/g" \
    -e "s/mttdz/\\\dot z_/g" \
    -e "s/mttdu/\\\dot u_/g" \
    -e "s/dot_/ \\\dot /g" \
    -e "s/mtta/A/g" \
    -e "s/mttb/B/g" \
    -e "s/mttc/C/g" \
    -e "s/mttd/D/g" \
    -e "s/mtte/E/g" \
    -e "s/mttg/G/g" \
    -e "s/mtti/I/g" \
    -e "s/mttm/M/g" \
    -e "s/mtto/O/g" \
    -e "s/mttv/V/g" \
    -e "s/mtty0/y_0/g" \
    -e "s/mttu0/u_0/g" \
    -e "s/mttx/x/g" \
    -e "s/mttz/z/g" \
    -e "s/mttyy/Y/g" \
    -e "s/mttw/w/g" \
    -e "s/mtttf/G/g" \
    -e "s/mttpar//g" \
    -e "s/\*\*/\^/g" \
    -e "s/\*/ /g" \
    -e "s/!/\\\/g" \
    -e "s/\\$//g" \
    -e "s/(/{(/g" \
    -e "s/)/)}/g" \
    -e "s/\left/\left (/g" \
    -e "s/\right/\right )/g" \
    -e "s/sqrt/\\\sqrt/g" \
    -e "s/theta/\\\theta/g" \
    -e "s/tau/\\\tau/g" \
    -e "s/alpha/\\\alpha/g" \
    -e "s/beta/\\\beta/g" \
    -e "s/gamma/\\\gamma/g" \
    -e "s/delta/\\\delta/g" \
    -e "s/epsilon/\\\epsilon/g" \
    -e "s/lambda/\\\lambda/g" \
    -e "s/mu/\\\mu/g" \
    -e "s/phi/\\\phi/g" \
    -e "s/rho/\\\rho/g" \
    -e "s/sigma/\\\sigma/g" \
    -e "s/omega/\\\omega/g" \
    -e "s/zeta/\\\zeta/g" \
    -e "s/infty/\\\infty/g" \
    -e "s/sin/\\\sin/g" \
    -e "s/cos/\\\cos/g" \
    -e "s/23/{23}/g" \
    -e "s/+-/ -/g" \
 | cat -s  | \
sed -e "s/ $//g" | \
tr  -s '\012' '\012' \
>junk

mv junk $1







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