home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / gopher / VieGOPHER / rosetex.awk.Z / rosetex.awk (.txt)
Encoding:
LaTeX Document  |  1993-06-15  |  2.8 KB  |  84 lines

  1. # FILE rosetex.awk
  2. # translate ROSE product file into LaTeX format for printing
  3. # written:       1992-10-23 <Gerhard.Gonter@wu-wien.ac.at>
  4. # latest update: 1993-05-29
  5. # ----------------------------------------------------------------------------
  6. BEGIN {
  7.   verb=0;
  8.   xverb=-1;
  9.   emptyline=0;          # number of empty lines suppressed in verbatim env.
  10.   args["#erase"]="\\subsection";
  11.   argt["#erase"]="Module";
  12.   args["#help"]="\\subsection";
  13.   argt["#help"]="{\\sl{help}}";
  14. # ----------------------------------------------------------------------------
  15. $1=="#section"||$1=="#subsection"||$1=="#subsubsection"||$1=="#paragraph" {
  16.   if (verb==1) {
  17.     print "\\end{verbatim}\n";
  18.     verb=0;
  19.   nm=substr($0,length($1)+2);
  20.   print "\\"substr($1,2)"{"nm"}\n";
  21.   if ($1=="#section") {
  22.     print "\\def\\LPtopC{"nm"}\n";
  23.     print "\\def\\LPtopD{~}\n";
  24.     print "\\def\\LPtopF{~}\n";
  25.   if ($1=="#subsection") {
  26.     print "\\def\\LPtopD{"nm"}\n";
  27.     print "\\def\\LPtopF{~}\n";
  28.   if ($1=="#subsubsection") {
  29.     print "\\def\\LPtopF{"nm"}\n";
  30.   next;
  31. # ----------------------------------------------------------------------------
  32. $1=="#erase"||$1=="#help" {
  33.   if (verb==1) {
  34.     print "\\end{verbatim}\n";
  35.     verb=0;
  36.   nm=substr($0,length($1)+2);
  37.   gsub("_","\\_",nm);
  38.   print args[$1]"{"argt[$1]" {\\tt "nm"}}\n"
  39.   print "\\def\\LPtopD{"argt[$1]" {\\tt "nm"}}\n";
  40.   print "\\def\\LPtopF{~}\n";
  41. #  /* this line needs to be printed too! */
  42. # ----------------------------------------------------------------------------
  43. $1=="#end" {
  44.   if (verb==1) {
  45.     print "\\end{verbatim}\n";
  46.     verb=0;
  47.   next;
  48. # ----------------------------------------------------------------------------
  49. $1=="#organize" {
  50.   args[$2]=$3;
  51.   argt[$2]=$4;
  52. # ----------------------------------------------------------------------------
  53. $1=="#verbatim" {
  54.   xverb=verb;
  55.   verb=2;
  56.   next;
  57. # ----------------------------------------------------------------------------
  58. $1=="#v" {
  59.   print substr($0,4);
  60.   next;
  61. # ----------------------------------------------------------------------------
  62. $1=="#endverbatim" {
  63.   verb=xverb;
  64.   next;
  65. # ----------------------------------------------------------------------------
  66. verb==0&&$0!=""&&$0!=" " {
  67.   print "\\begin{verbatim}"
  68.   verb=1;
  69.   emptyline=0;
  70. # ----------------------------------------------------------------------------
  71. verb==1 {
  72.   if ($0==""||$0==" ") {
  73.     emptyline++;
  74.   } else {
  75.     for (; emptyline>0; emptyline--) print "";  # make empty line
  76.     print
  77. # ----------------------------------------------------------------------------
  78. verb==2 { print }       # LaTeX section in ROSE product file
  79. # ----------------------------------------------------------------------------
  80. END {
  81.   if (verb==1) {
  82.     print "\\end{verbatim}\n";
  83.     verb=0;
  84.