[TxMt] Re: Latex tables and Excel

William Yang weijiay at gmail.com
Sun Oct 1 20:58:28 UTC 2006


Charilaos Skiadas wrote:
> Will,
> On Oct 1, 2006, at 2:15 PM, William Yang wrote:
> 
>> 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?
> 
> Ok, first answering Daniel's OT question:
> There is the R language, depending on what you want to do. I will 
> probably use it for most of my spreadsheeting needs. 
> http://www.r-project.org/
> 
>>> 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
> 
> So, could you explain to us why just copying and pasting from Excel 
> didn't work for you? I don't have Excel on my mac to test, but the Excel 
> in my windows machine seems to paste the cells as being tab-delimited, 
> which IIRC is what the convert macro expects, so it would seem you 
> wouldn't need to do anything at all differently. So could you show us 
> the pasted Excel text that wasn't working for you? (You can use the 
> Pastie service, i.e. select the text in textmate, and press 
> ctrl-shift-opt-V, then paste the resulting link here.
> 
>> Will
> 
> Haris
> 
> 
> 
http://pastie.caboo.se/15703
But this doesn't seem to preserve the tabs?

Here it is pasted directly:

Size	GCC IPC	GZIP IPC
1024	0.8026	0.1987
2048	0.8031	0.1987
4096	0.8025	0.1987
32768	0.8026	0.1987

This is what the "Convert table.." in the Latex bundle output:

\begin{tabular}{cc}
\hline
Size & GCC IPC GZIP IPC\\
\hline
1024 & 0.8026 & 0.1987\\
2048 & 0.8031 & 0.1987\\
4096 & 0.8025 & 0.1987\\
32768 & 0.8026 & 0.1987\\
\hline
\end{tabular}
The numbers are parsed right, but the title is not.

This is how my script outputs, which is the correct one:
\table[ht]
	\centering
	\begin{tabular}{ccc}
	\hline
	Size & GCC IPC & GZIP IPC\\
	\hline
	1024 & 0.8026 & 0.1987\\
	2048 & 0.8031 & 0.1987\\
	4096 & 0.8025 & 0.1987\\
	32768 & 0.8026 & 0.1987\\
	\hline
	\end{tabular}
	\caption{Table Caption}
	\label{Table Label}
\end{table}



Will




More information about the textmate mailing list