2

I have following csv file that I want to read and display as table:

"";"a01";"a02";"a03";"a04";"a05";"b01";"b02";"b03";"b04";"b05";"t01"
"a01";0;147632;181326;199650;271006;197441;215211;291227;131358;126435;268400
"a02";147632;0;456;145466;259520;136489;165306;768;174075;160202;256612
"a03";271006;259520;0;249326;0;249935;249608;241720;326917;292472;263386
"a04";7;119114;0;0;246267;133549;263651;258427;6;193472;251168
"a05";199650;145466;256502;0;0;135343;131358;259080;234963;250919;343499
"b01";197441;6;133549;763;249935;0;162260;259712;233051;678;251516
"b02";215211;165306;148099;6;249608;162260;0;256502;253780;228519;245948
"b03";256612;270029;258427;6;241720;259712;256502;0;343499;308085;263651
"b04";131358;8;215073;54;326917;233051;253780;0;0;678;313316
"b05";126435;160202;193472;211280;292472;209561;228519;0;0;0;283208
"t01";268400;256612;251168;6;263386;251516;245948;263651;256502;283208;0

Following code it is basically working but problem is that the table does not fit to the document boundaries:

\singlespacing
\csvautotabular[separator=semicolon]{./tables/matrix.csv}
\doublespacing

My requirements:

  1. First row/column is header and should be bold or somehow highlighted if it is possible (if not no matter)
  2. If the number is too long for column width then the number can be line/word wrapped
  3. Include the table in Content section and also being able to reference to it in text.

There are answers to particular questions but none of them accompany all my requirements and unfortunately I do not know how to combine them to gain desired goal. AFAIK there is also csvreader function which allows better control of the column style, titles and content. But I'm struggling with it and I'm afraid that I've misunderstood something crucial here (in whole LaTeX philosophy, not just this package). I simply do not understand the syntax, structure etc. and reading the LaTeX manuals is pain for me e.g.

This example mentions following code (I've pretty printed it):

\csvreader[tabular          = |l|l|c|,
           table head       = \hline & Name & Age\\\hline,
           late after line  = \\\hline]%
           {scientists.csv}
           {name=\name,
            surname=\surname, age=\age}%
          {\thecsvrow & \surname~\name & \age}%
  1. Why there are % signs? Isn't % for comments?
  2. If I understand correct then all between [] are non mandatory options for csvreader function/macro and e.g. tabular, late after line are parameters. All between {} are mandatory options right? So the general syntax is like: csvreader[]%{}{}%{}% right? If both [] and {} purpose is for dealing with parameters why there is one non mandatory group (or what is the correct name) and three mandatory, why not just all pass to {} with proper key/value?
  3. The documentation for tabular says:

Surrounds the CSV processing with \begin{tabular}{<table format>} at begin and \end{tabular} at end.

But what is tabular?

  1. How can I figure out which parameters should I use with csvreader to gain my goal and do not annoy community which such basic stupid questions?

Thank you.

  • A good question is never an annoyance. Go ahead and post a complete MWE http://meta.tex.stackexchange.com/q/3343/90087 so that others can play with your code. – A Feldman May 14 '16 at 13:16
  • One could use the standalone package for a MWE for this question, in order for it to be completely contained within the example, am I correct in that? – A Feldman May 14 '16 at 13:35