12.07.2015 Views

Manual for the csvsimple package

Manual for the csvsimple package

Manual for the csvsimple package

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1.1 Loading <strong>the</strong> PackageThe <strong>package</strong> <strong>csvsimple</strong> loads <strong>the</strong> <strong>package</strong>s pgfkeys [3] and if<strong>the</strong>n [1]. <strong>csvsimple</strong> itself isloaded in <strong>the</strong> usual manner in <strong>the</strong> preamble:\use<strong>package</strong>{<strong>csvsimple</strong>}1.2 First StepsEvery line of a processable CSV file has to contain an identical amount of comma 3 separatedvalues. The curly braces {} of TEX groups can be used to mask a block which may containcommas not to be processed as separators.The first line of such a CSV file is usually but not necessarily a header line which contains <strong>the</strong>identifiers <strong>for</strong> each column.CSV file grade.csvname,givenname,matriculation,gender,gradeMaier,Hans,12345,m,1.0Huber,Anna,23456,f,2.3Wei\ss{}b\"{a}ck,Werner,34567,m,5.0The most simple way to display a CSV file in tabular <strong>for</strong>m is <strong>the</strong> processing with <strong>the</strong>\csvautotabular → P. 7 command.\csvautotabular{grade.csv}name givenname matriculation gender gradeMaier Hans 12345 m 1.0Huber Anna 23456 f 2.3Weißbäck Werner 34567 m 5.0Typically, one would use \csvreader → P. 6 instead of \csvautotabular to gain full control over<strong>the</strong> interpretation of <strong>the</strong> included data.In <strong>the</strong> following example, <strong>the</strong> entries of <strong>the</strong> header line are automatically assigned to TEX macroswhich may be used deliberately.\begin{tabular}{|l|c|}\hline%\bfseries Person & \bfseries Matr.~No.\csvreader[head to column names]{grade.csv}{}%{\\\givenname\ \name & \matriculation}%\\\hline\end{tabular}PersonMatr. No.Hans Maier 12345Anna Huber 23456Werner Weißbäck 345673 See /csv/separator → P. 15 <strong>for</strong> o<strong>the</strong>r separators than comma.2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!