summaryrefslogtreecommitdiff
path: root/report/pyp_clustering/format-grammar-latex.pl
blob: e1fe3e45e4093b4279150b7ff7b14f43ea26e9ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl -w
use strict;
my $x = '';
while(<>){
  if (/^$/) { print "\\hline\n"; next; }
  if (/^(\d+)$/) {
    $x=$1;
    $x=~s/^(\d\d\d)(\d\d\d)(\d\d\d)$/$1,$2,$3/;
    $x=~s/^(\d\d)(\d\d\d)(\d\d\d)$/$1,$2,$3/;
    $x=~s/^(\d)(\d\d\d)(\d\d\d)$/$1,$2,$3/;
    $x=~s/^(\d\d\d)(\d\d\d)$/$1,$2/;
    $x=~s/^(\d\d)(\d\d\d)$/$1,$2/;
    $x=~s/^(\d)(\d\d\d)$/$1,$2/;
    next;
  }
  s/ \|\|\| LHSProb.*$//; s/ \|\|\| / \\rightarrow \\langle \\textrm{/; s/\[X(\d+)\]/\\textrm{X}^{$1}/;
  s/ \|\|\| /},\\textrm{{\\emph /;
  chomp;
  print "$x & \$ $_}} \\rangle \$ \\\\\n";
  $x="";
}