NAME

csv2lyx - converter from csv-file to a LyX table


DESCRIPTION

Converts a Comma Separated Value file to a float table in LyX format. Good for LyX version 1.1.4fix1 and other. You can use it whit the LyX-server too.


HOW USE IT

Creating a LyX file

under Linux one of the follow (see also the many Options):

 antonio@bidone:~ > cat mycsvfile | csv2lyx > mytmptable.lyx
 antonio@bidone:~ > cat mycsvfile | csv2lyx --output=mytmptable.lyx
 antonio@bidone:~ > csv2lyx mycsvfile > mytmptable.lyx
 antonio@bidone:~ > csv2lyx mycsvfile --output=mytmptable.lyx  
 antonio@bidone:~ > csv2lyx mycsvfile       -o mytmptable.lyx  
 antonio@bidone:~ > csv2lyx mycsvfile --lyxserver

As default this will create a Float-Table in the LyX format, version 2.15 (used by LyX-1.1.4fix1 but readable by higher versions as well).

Using the created LyX file

Include as external LyX file
as usal: Insert --> Include File --> Use Include (mytmptable.lyx)

Insert directly in your LyX document
as usal: Insert --> LyXfile (mytmptable.lyx)


Options

 -s or --separator="what you want"
 -o or --output='A filename, please!'
 -l or --label='A label for crossreference to the table'
 -f or --fontsize=-3|-2|-1|+1|+2|+3
 -c or --colspan="a pattern" or --multicolumn="a pattern" 
 -vl or --vlines
 -hl or --hlines   
 -g or --grid      
 -b or --border    
 -h or --header='N'  
 -t or --title="A pretty title for a pretty table" 
 -L or --lyxserver
 --nofloat
 --help

--fontsize

 -f or --fontsize=-3|-2|-1|+1|+2|+3

-1 means small, -2 means smaller , +1 means large, and so on. Very usefull in LyX-1.1.6, where formatting each cell is very cumbersome.

--separator

 -s or --separator="what you want"

default: ``\t'' for a tab-separated file

--output

 -o or --output='A filename, please!'

default: STDOUT aka Screen. That means, that you can use the pipe, if you want:

 antonio@bidone > csv2lyx pippo.csv > pippo.lyx

is the same as

 antonio@bidone > csv2lyx pippo.csv -o pippo.lyx

If you use --lyxserver, then --output is overwriten by a random filename.

--lyxserver

 -L or --lyxserver

With this option, you can past the table direct in a LyX-document at the current editing point (the place of the cursor).

Of course, to have this working, you need to have an open LyX-document.

This option is valid only when the lyxserver is started:

What's the ``lyxserver''?

Good question. A partial, but simple answord is: go in your lyxrc and write the line

 \serverpipe "~/.lyxpipe"

The lyxserver works on *NIX, OS/2, but not Win32!

If you have problems, close LyX, rm ~/.lyxpipe.in and ~/.lyxpipe.out. Restart. Better: look on the LyX-Documentation ``Configuration.lyx''.

--title

 -t or --title="A pretty title for a pretty table"

default: inputfilename otherwise, when you use the pipe, ``Title of the LyX
table''

--label

 -l or --label='A label for crossreference to the table'

default: none

--nofloat

If you don't want a Float-Table. In this case the options --title and --label are ignored.

default: Float-Table

--header

 -h or --header='N'  (--header is the same as --header='1')

The first N rows are a Header.

Default: noheader

A line is made under the last row of the Header. If --border, --grid or --hlines are activated, then are two lines unter the last row of the Header.

--border

 -b or --border

A line around the table.

Default: noborder

--grid

 -g or --grid

All cells separated by lines. The same as --border, --vlines, --hlines.

Default: nogrid

--hlines

 -hl or --hlines

Horizonal line between each row.

--vlines

 -vl or --vlines

Vertical lines between each column.

--colspan

 -c or --colspan="a pattern"

Multicolumns: cells that span over several columns

One can indicate, line for line whether some columns should be joined. Number n indicates how many columns the nth value should be in. The slash separates lines. If less than the existing columns are indicated, the remaining numbers are assumed to be 1 (i.e. one column per value). Also, 'empty' lines are automatically set to 'normal' (one column per value).

Here are some examples:

--colspan=``23'' or --colspan=``23/////'' or --colspan=``23/11111//// or ...
   +-------------+----------------------+
 1 |  2 columns  |         3 columns    |
   +-----+-------+-----+--------+-------+
 2 |     |       |     |        |       |
--colspan=``23/221'' or --colspan=``23/22''
   +-------------+----------------------+
 1 |  2 columns  |         3 columns    |
   +-----+-------+-----+--------+-------+
 2 |  2 columns  |   2 columns  | 1 col |
   +-----+-------+-----+--------+-------+
 3 |     |       |     |        |       |
--colspan=``23//221'' or --colspan=``23/11111/221''
   +-------------+----------------------+
 1 | 2 columns   |         3 columns    |
   +-----+-------+-----+--------+-------+
 2 |     |       |     |        |       |
   +-----+-------+-----+--------+-------+
 3 | 2 columns   |   2 columns  | 1 col |
   +-----+-------+-----+--------+-------+
 4 |     |       |     |        |       |
--colspan=``/12/212'' or --colspan=``11111/1211/212''
   +-----+-------+-------+--------+-------+
 1 |     |       |       |        |       |
   +-----+-------+-------+--------+-------+
 2 |1 col|     2 columns |        |       |
   +-----+-------+-------+--------+-------+
 3 | 2 columns   | 1 col |      2 columns |
   +-----+-------+-------+--------+-------+
 4 |     |       |       |        |       |


WILL COME (maybe)

Next features are:

--format=``|p{3cm}|c|''
formatting the column, with LaTeX syntax


BUGS

Using --lyxserver your data are on the /tmp directory. Maybe everybody can see your data.


AUTHOR, COPYLEFT and THANKS

Copyright (C) 2001, Antonio Gulino <antonio.gulino@tin.it>

This program is free software; you can redistribute it and/or modify it under the term of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

Thanks to Guenter Milde <G.Milde@physik.tu-dresden.de> for translation and improvement of the Documentation.