summaryrefslogtreecommitdiff
path: root/report/pyp_clustering/format-grammar-latex.pl
diff options
context:
space:
mode:
Diffstat (limited to 'report/pyp_clustering/format-grammar-latex.pl')
-rwxr-xr-xreport/pyp_clustering/format-grammar-latex.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/report/pyp_clustering/format-grammar-latex.pl b/report/pyp_clustering/format-grammar-latex.pl
new file mode 100755
index 00000000..e1fe3e45
--- /dev/null
+++ b/report/pyp_clustering/format-grammar-latex.pl
@@ -0,0 +1,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="";
+}