Skip to content

Instantly share code, notes, and snippets.

@kiyotakagoto
Created February 7, 2012 05:42
Show Gist options
  • Save kiyotakagoto/1757478 to your computer and use it in GitHub Desktop.
Save kiyotakagoto/1757478 to your computer and use it in GitHub Desktop.
latex : 行と列の入れ替え(最低限の機能)
use strict;
my( @row );
while(<STDIN>){
chomp;
s/\s*\\\\\s*//g;
s/\\hline//g;
push @row, [split /\s*&\s*/];
}
for( my $i = 0; $i <= $#{@{$row[0]}}; $i++ ){
for( my $j = 0; $j <= $#row; $j++ ){
$row[$j][$i] .= " & " if $j != $#row;
print $row[$j][$i];
}
print " \\\\ \\hline\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment