#! /bin/awk -f ############################################################################# ## #A xpl2tex GAP Utility Goetz Pfeiffer ## #A @(#)$Id: xpl2tex,v 1.1 1993/10/19 13:11:21 goetz Rel $ ## #Y Copyright 1992, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany ## ## This 'awk' script transforms a GAP example file into 'TeX' input. ## #H $Log: xpl2tex,v $ #H Revision 1.1 1993/10/19 13:11:21 goetz #H Initial revision #H ## st == 0 { if ($0 ~ /^ *$/) st++ next } st == 1 { if ($0 ~ /^ *$/) st++ else if ($2 == "\end{document}") { st = 5 print $2 } else print substr($0, 5) next } st == 2 { if ($1 == "##") { printf("\n%s\n", substr($0, 5)) st-- } else { printf("\n| %s", $0) st++ } next } st == 3 { if ($0 ~ /^ *$/) st++ else printf("\n %s", $0) next } st == 4 { if ($0 ~ /^ *$/) printf("\n") else if ($1 == "##") { printf(" |\n\n%s\n", substr($0, 5)) st = 1 } else { printf("\n\n %s", $0) st-- } next }