# [texhax] Tables from Files [Cheers]

Uwe Lück uwe.lueck at web.de
Thu Jul 13 21:51:24 CEST 2006

At 14:22 12.07.06, Ulf Markwardt wrote:

> >I am looking for a package that makes it possible to directly input data
> from
> >a file into a table like \tabularfromfile{filename.csv}[formatoptions].

At 13:32 12.07.06, Susan Dittmar wrote:

>Quoting Uwe Lück (uwe.lueck at web.de):
> > I do not know such a macro package, but it should be very very
> > simple to make one.
>
>Thanks, Uwe, for your hint on how to create such a macro. Those hints are
>the main reason for me to read this mailing list!

Thanks for the encouragement, Susan!

>I may be mistaken, not having read much about it yet, but to me it looks
>like csvtools (mentioned earlier in this thread) does exactly that.

I didn't know csvtools before -- and here reading the list makes
/me/ happy. I didn't understand 'csv' indeed. In a few minutes,
I couldn't figure out the point of loading csvtools. However,
/commas/ seem to be essential for CommaSeparatedVariables.
My point was that TeX doesn't have a special preference
for commas or blank spaces in parsing (common formats /do/
somewhat prefer curly braces [LaTeX uses comma-separated
lists at at least 3 or 4 occasions, yet without a common macro]).

At 14:22 12.07.06, Ulf Markwardt wrote:

>here is the solution which is what I had in mind.
>
>{
>\catcode\,=\catcode\&
>\catcode\
>=\active%
>\def
>{\\ \hline}%
>\begin{tabular}[hbt]{|c|c|c|}
>% place header
>\input{tabelle.csv}%
>\end{tabular}%
>}

Great -- a minimal CSV tool! Again I'm happy to read the list.
Seems Ulf became convinced that rather he is a real wizard
himself than a real wizard will answer.

[BTW, some bad processor seems to have split the
\begin{tabular}' line from the `% place' line.]

Cheers,

Uwe.

More information about the texhax mailing list