summaryrefslogtreecommitdiff
path: root/stuff/tabella.pl
diff options
context:
space:
mode:
Diffstat (limited to 'stuff/tabella.pl')
-rw-r--r--stuff/tabella.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/stuff/tabella.pl b/stuff/tabella.pl
new file mode 100644
index 0000000..93c1123
--- /dev/null
+++ b/stuff/tabella.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my @lineterm=qw(& & \\\\);
+my $state=0;my $mline=0;
+while (my $line=<>) {
+ if ($state==0) {
+ if ($line=~/matrix/) {$state=1};
+ }
+ if ($state==1) {
+ if ($line=~/{/) {$state=2};
+ }
+ if ($line=~/\\end/) {$state=3}
+ if ($state==2) {
+ $line=~s[}\s*(&|\\\\|)\s*(%.*)?$][} $lineterm[$mline%3] $2\n]
+ and ++$mline;
+ }
+ print $line;
+ if ($mline==18) {
+ $mline=0;
+ print <<'EOM';
+};
+\end{tikzpicture}
+
+\begin{tikzpicture}
+\matrix
+{
+EOM
+ }
+}