https://github.com/wtwhite/speedy_colorful_subtrees
Raw File
Tip revision: 5acf83710cbd521310f3703dd22c59c1891b9574 authored by wtwhite on 16 March 2015, 06:47:49 UTC
Code for the Speedy Colorful Subtrees paper
Tip revision: 5acf837
make_latex_table.pl
#!/usr/bin/perl

use strict;
use warnings;

my $cols = shift or die "Must specify columns!";
#print "\\begin{table}{$cols}\n";
print "\\begin{longtable}{$cols}\n";

while (<>) {
	chomp;
	s/\r\z//;
	
	my @f;
	while (s/\A([^",]+|"(.*?)"),?//) {		#HACK: Broken regex, but good enough
		my $x = $1;
		$x =~ s/"//g;		#HACK
		$x =~ s/_/\\_/g;
		push @f, $x;
	}
	
	print "\\hline\n" if $. <= 2;
	print join("\t&\t", @f), "\\\\\n";
}

print "\\hline\n";
#print "\\end{table}\n";
print "\\end{longtable}\n";
back to top