Daniel Käsmayr wrote:
Will,
an interesting question I was thinking about last night as well. I haven't tested this, but exporting as csv (comma separated or any other symbol is posssible, I believe) opens up all kinds of possibilities with TextMate's regex search…?
btw and very OT: … is there any alternative to excel on the mac? a) for calculating and b) for plotting?
Dan
I was hoping for something simpler since I work with small tables...something like copy table into Textmate, click convert, and boom, Latex table. I modified the existing Convert Table script to work with Excel and it works for my needs, but probably misses many corner cases. If anyone has a better solution please post. Thanks
Will
#!/usr/bin/perl -w $line=<>; $count=0; $line=~s/^\s+//; while ($line=~s/(\w)\t+(\w)/$1 & $2/) { $count++; } $line=~s/\n/\\\n/; $greeting="\table[ht]\n"; $greeting.="\t\centering\n"; $greeting.="\t\begin{tabular}{"; for (0..$count) { $greeting.="c"; } $greeting.="}\n"; print $greeting; $hline="\t\hline\n"; print $hline."\t".$line.$hline; while ($line=<>) { $line=~s/^\s+//; $line=~s/\t+/ & /g; $line=~s/\n/\\\n/; print "\t$line"; } print "\\\n".$hline."\t\end{tabular}\n"; print "\t\caption{Table Caption}\n"; print "\t\label{Table Label}\n"; print "\end{table}\n";