Re: How to embed a spreadsheet in LyX or LaTeX?
Helge Hafting wrote: > Steve Litt wrote: >> Hi all, >> How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX >> document? > > I wrote an external inset for spreadsheets some time ago. > You can find it here: > http://www.mail-archive.com/lyx-de...@lists.lyx.org/msg132049.html put it in wiki? pavel
Re: How to embed a spreadsheet in LyX or LaTeX?
Steve Litt wrote: Hi all, How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX document? I wrote an external inset for spreadsheets some time ago. You can find it here: http://www.mail-archive.com/lyx-de...@lists.lyx.org/msg132049.html It supports openoffice, excel and gnumeric spreadsheets. It is necessary to have gnumeric installed, as gnumeric is the spreadsheet->latex converter. My external inset needs a recompile of LyX, because the latex export uses some packages that Lyx didn't know about at the time. It will still work if you don't recompile, but then you need to add some \usepackage statements to your latex preamble. Helge
Re: How to embed a spreadsheet in LyX or LaTeX?
On 11.08.2009, at 23:48, Phil wrote: You might also try excel2latex I can also recommend excel2latex. I used it quite a lot when I was writing my thesis. The nice thing about it is that it also preserves a sensible part of the formattings (e.g., bold headlines, right aligned data, ...). The following process worked pretty well for me: (1) Open an empty, but compilable LaTeX document (ou may export an empty LyX document to LaTeX to get one) in your favorite text editor. (2) Use excel2latex to copy the marked part of the Excel table as LaTeX code into the clipboard. (3) Paste the table into the LaTeX document and save the document. (4) Import the LaTeX document into LyX. (5) Copy the table from the imported LyX document into the target document. Daniel
Re: How to embed a spreadsheet in LyX or LaTeX?
On Wednesday 12 August 2009, Les Denham wrote: > On Wednesday 12 August 2009, Paul A. Rubin wrote: > > Dynamic link (user sees a table in the LyX doc, and can interact > > with it, making changes in the spreadsheet). This would typically occur > > with the user reading the finished product (PDF, DVI) in a viewer, not > > reading it in LyX, so you get into issues of whether the viewer program > > supports this sort of embedding. For instance, if you export the > > document in HTML and view it in a browser, I think there are browser > > plugins that let you edit a spreadsheet in situ (although I confess I've > > never done it). > > This kind of approach is possible in theory: for example, if you have a > figure in LyX which is a Grace file, editing that file in Grace will change > the figure in Lyx immediately. That is not the same as just editing an > image: the Grace file is actually displayed in LyX using Grace in a command > line mode. > > The problem with a spreadsheet is that Excel does not (as far as I know) > have a command line interface. Neither does OpenOffice.org. Gnumeric has > a Python API which might be usable, but I haven't tried it. The best > possibility I'm aware of is the Perl module XLSperl > (http://search.cpan.org/~jonallen/XLSperl-0.7/bin/XLSperl) which could be > used to build an image from specified sheet, rows and columns. Once you > have done this, the Perl script could be used in a converter (XLS->EPS, for > example). But I don't think it would be a trivial task to do this. If all you need is row+column data from an excel spreadsheet, you could also use the perl module Spreadsheet::ParseExcel to parse the excel file, and then write the cells out in latex tabular format. Then just \input{exceltable.tex}. I've done something similar to generate longtables using excel data. Of course if you want charts, etc. from the excel file, that would be more difficult. You could use something like the following perl code to parse your excel file and output a latex table: #!/usr/bin/perl use strict; use warnings; #use Text::CSV; use Text::CSV_XS; use Spreadsheet::ParseExcel; if($#ARGV!=1){ print "Usage $0 excelfile outfile"; exit; } my $file = $ARGV[0]; my $ofile = $ARGV[1]; open (TEX, ">$ofile") or die $!; my @fields; &process_xls(); close TEX exit; # need to quote latex special characters sub latexquote(){ my $s=$_[0]; $s =~ s/&/\\&/g; $s =~ s/#/\\#/g; $s =~ s/\$/\\\$/g; $s =~ s/%/\\%/g; $s =~ s/{/\\{/g; $s =~ s/}/\\}/g; $s =~ s/_/\\_/g; $s =~ s/\.\ /\.\\\ /g; return $s; 1; } sub print_record() { my $flds = $_[0]; if(ref($flds) ne 'ARRAY' ) { die "Expected array ref, not $flds\n"; } #unless (@_ == 1 && ref($flds) eq 'ARRAY') { die "usage: print_record(array_ref)\n"; } my $l...@$flds; for(my $i=0; $i<$len; $i++) { print(TEX, "\&") if($i !=0); #Tab Character print(TEX, &latexquote($flds->[$i]); } print(TEX, " \n"); #End of Row } sub process_xls() { my $oExcel = new Spreadsheet::ParseExcel; my $oBook = $oExcel->Parse($ARGV[0]); my($iR, $iC, $oWkS, $oWkC, $fld); print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n" if defined $oBook->{Author}; print(TEX, "\\begin{tabular}"); #print {column formatting} #print column headings # Loop over sheets for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { $oWkS = $oBook->{Worksheet}[$iSheet]; print "- SHEET:", $oWkS->{Name}, "\n";
Re: How to embed a spreadsheet in LyX or LaTeX?
On Wed, Aug 12, 2009 at 11:36 PM, Paul A. Rubin wrote: > This could turn into a viewer issue (at least partially), depending on what > Steve has in mind. There are four "levels" of embedding I can think of: Adding spreadsheet to Insert->File->External Material sounds like a good start. Like how .fig is handled but with something like PyODConverter instead of transfig. http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.html Presumbaly PyODConverter can convert any xls file that OO supports. -- John C. McCabe-Dansted
Re: How to embed a spreadsheet in LyX or LaTeX?
On Wednesday 12 August 2009, Paul A. Rubin wrote: > Dynamic link (user sees a table in the LyX doc, and can interact > with it, making changes in the spreadsheet). This would typically occur > with the user reading the finished product (PDF, DVI) in a viewer, not > reading it in LyX, so you get into issues of whether the viewer program > supports this sort of embedding. For instance, if you export the > document in HTML and view it in a browser, I think there are browser > plugins that let you edit a spreadsheet in situ (although I confess I've > never done it). This kind of approach is possible in theory: for example, if you have a figure in LyX which is a Grace file, editing that file in Grace will change the figure in Lyx immediately. That is not the same as just editing an image: the Grace file is actually displayed in LyX using Grace in a command line mode. The problem with a spreadsheet is that Excel does not (as far as I know) have a command line interface. Neither does OpenOffice.org. Gnumeric has a Python API which might be usable, but I haven't tried it. The best possibility I'm aware of is the Perl module XLSperl (http://search.cpan.org/~jonallen/XLSperl-0.7/bin/XLSperl) which could be used to build an image from specified sheet, rows and columns. Once you have done this, the Perl script could be used in a converter (XLS->EPS, for example). But I don't think it would be a trivial task to do this. -- Les ~~ Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
Re: How to embed a spreadsheet in LyX or LaTeX?
rgheck wrote: On 08/11/2009 03:31 PM, Steve Litt wrote: How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX document? If you do want it to be editable, then I have no idea. This could turn into a viewer issue (at least partially), depending on what Steve has in mind. There are four "levels" of embedding I can think of: 1. Static (data is copied in once, does not change if the spreadsheet changes). There've been a few responses on the list along those lines. 2. Dynamic (the LyX doc contains a non-interactive table, but it automagically updates if the spreadsheet changes). With other programs, this typically requires DDE (on Windows), but it could probably be faked with a script that the user would run manually. The script would have to crank up the spreadsheet and dump the relevant table(s) to some sort of intermediate file(s) (CSV?). 3. Static link (user sees a link in the LyX doc, clicks it to open the spreadsheet in an external program). I doubt this is what Steve wants, since embedding links in LyX docs is well known. 4. Dynamic link (user sees a table in the LyX doc, and can interact with it, making changes in the spreadsheet). This would typically occur with the user reading the finished product (PDF, DVI) in a viewer, not reading it in LyX, so you get into issues of whether the viewer program supports this sort of embedding. For instance, if you export the document in HTML and view it in a browser, I think there are browser plugins that let you edit a spreadsheet in situ (although I confess I've never done it). /Paul
Re: How to embed a spreadsheet in LyX or LaTeX?
You might also try excel2latex
Re: How to embed a spreadsheet in LyX or LaTeX?
Steve Litt schrieb: Hi all, How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX document? Thanks SteveT Steve Litt Recession Relief Package http://www.recession-relief.US Twitter: http://www.twitter.com/stevelitt Hi Steve, in Excel * mark the cells you wnat to show in your document * export marked area to eps in LyX -- * import eps graphic So you have a scalable graphic and no problems with bitmap resolution HTH Hellmut -- Dr. Hellmut Weber m...@hellmutweber.de Degenfeldstraße 2 tel +49-89-3081172 D-80803 München-Schwabing mobil +49-172-8450321 please: No DOCs, no PPTs. why: tinyurl.com/cbgq
Re: How to embed a spreadsheet in LyX or LaTeX?
On 08/11/2009 03:31 PM, Steve Litt wrote: Hi all, How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX document? What do you want them to look like? Do you want them to be editable? If not, then export to csv and you can use the import filter. If you do want it to be editable, then I have no idea. rh
How to embed a spreadsheet in LyX or LaTeX?
Hi all, How can I embed a spreadsheet (MS Excel I assume) into a LyX or LaTeX document? Thanks SteveT Steve Litt Recession Relief Package http://www.recession-relief.US Twitter: http://www.twitter.com/stevelitt