2

I have a csv File with 400 lines and 3 columns and I want to generate one Table over more site (I guess there will be 3 pages). In addition there should be 4 columns of table at one site like this: Example

Is it possible to generate this with csvread automatically. P.S. I think the Whole csv file does not make sense for you if I upload it. And I really have no idea how to start, instead of the thinks I found here so there is no tex Code. UPDATE: I just triied to use supertaabular and csvsimple but it does not run together.

\begin{filecontents*}{NACA0012.csv}
Nr;x;y
1;1;0.00126
2;0.997596;0.001597
3;0.993757;0.002133
4;0.989627;0.002706
5;0.985199;0.003318
6;0.980473;0.003967
7;0.975459;0.004652
8;0.970173;0.005369
9;0.96464;0.006115
10;0.95889;0.006885
11;0.952954;0.007675
12;0.946864;0.008479
13;0.940648;0.009294
14;0.934333;0.010115
15;0.927938;0.010941
16;0.921483;0.011768
17;0.914981;0.012595
18;0.908444;0.013421
19;0.901878;0.014243
20;0.895292;0.015062
21;0.88869;0.015876
22;0.882076;0.016686
23;0.875452;0.017491
24;0.86882;0.01829
25;0.862183;0.019084
26;0.855541;0.019872
27;0.848896;0.020655
28;0.842247;0.021432
29;0.835596;0.022204
30;0.828943;0.022969
31;0.822288;0.023729
32;0.815632;0.024483
33;0.808974;0.025232
34;0.802315;0.025974
35;0.795655;0.026711
36;0.788994;0.027442
37;0.782333;0.028167
38;0.77567;0.028887
39;0.769008;0.0296
40;0.762344;0.030308
41;0.755681;0.03101
42;0.749017;0.031705
43;0.742353;0.032395
44;0.735688;0.033079
45;0.729024;0.033757
46;0.72236;0.034429
47;0.715695;0.035095
48;0.709031;0.035755
49;0.702368;0.036408
50;0.695704;0.037056
51;0.689041;0.037697
52;0.682379;0.038332
53;0.675717;0.03896
54;0.669056;0.039582
55;0.662396;0.040197
56;0.655736;0.040806
57;0.649078;0.041408
58;0.64242;0.042003
59;0.635764;0.042592
60;0.629108;0.043173
61;0.622454;0.043748
62;0.615802;0.044315
63;0.609151;0.044875
64;0.602501;0.045428
65;0.595853;0.045973
66;0.589207;0.046511
67;0.582562;0.047041
68;0.57592;0.047563
69;0.569279;0.048077
70;0.562641;0.048583
71;0.556005;0.049081
72;0.549371;0.04957
73;0.542739;0.050051
74;0.536111;0.050524
75;0.529484;0.050987
76;0.522861;0.051442
77;0.51624;0.051887
78;0.509623;0.052323
79;0.503008;0.052749
80;0.496397;0.053166
81;0.489789;0.053573
82;0.483185;0.05397
83;0.476584;0.054357
84;0.469987;0.054733
85;0.463394;0.055098
86;0.456805;0.055453
87;0.45022;0.055796
88;0.443639;0.056128
89;0.437063;0.056449
90;0.430492;0.056757
91;0.423925;0.057054
92;0.417364;0.057338
93;0.410807;0.05761
94;0.404256;0.057869
95;0.397711;0.058115
96;0.391172;0.058347
97;0.384638;0.058566
98;0.378111;0.05877
99;0.37159;0.058961
100;0.365076;0.059136
101;0.358569;0.059297
102;0.352069;0.059443
103;0.345577;0.059573
104;0.339092;0.059687
105;0.332616;0.059785
106;0.326148;0.059866
107;0.319689;0.059931
108;0.31324;0.059977
109;0.306799;0.060006
110;0.300369;0.060017
111;0.29395;0.060009
112;0.287541;0.059983
113;0.281144;0.059936
114;0.274759;0.05987
115;0.268386;0.059783
116;0.262026;0.059676
117;0.255681;0.059547
118;0.24935;0.059396
119;0.243034;0.059223
120;0.236735;0.059027
121;0.230453;0.058807
122;0.224189;0.058563
123;0.217944;0.058295
124;0.21172;0.058002
125;0.205518;0.057683
126;0.199339;0.057337
127;0.193185;0.056965
128;0.187058;0.056565
129;0.180961;0.056136
130;0.174894;0.05568
131;0.168862;0.055193
132;0.162867;0.054677
133;0.156913;0.054131
134;0.151004;0.053553
135;0.145144;0.052945
136;0.139338;0.052305
137;0.133592;0.051633
138;0.127913;0.05093
139;0.122309;0.050196
140;0.116787;0.049432
141;0.111357;0.048637
142;0.106028;0.047814
143;0.100812;0.046964
144;0.095719;0.046089
145;0.090761;0.045192
146;0.085949;0.044274
147;0.081294;0.04334
148;0.076804;0.042393
149;0.072489;0.041437
150;0.068354;0.040474
151;0.064404;0.039509
152;0.06064;0.038544
%and so on.....


\end{filecontents*} 
\documentclass{article} 
\usepackage{csvsimple}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{supertabular}
\begin{document}
\twocolumn
\csvreader[
  supertabular=|c|c|c|,
  table head=\caption{test\label{tab:test}}\\ \hline
    \toprule Nr. & $x/l$    &   $y/l$ \\ \midrule\endfirsthead
    \toprule Nr. & $\frac{x}{l}$        &   $\frac{y}{l}$\\ \midrule\endhead
    \bottomrule\endfoot,
  late after line=\\,separator=semicolon,
]{NACA0012.csv}{1=\Nr,2=\x,3=\y}{\Nr&\x&\y}
\end{document}
4

1 Answer 1

1

You can use supertabular with csvsimple inserting a \csvreader into a supertabular environment.

I've also used booktabs for a better layout and siunitx for a better number alignment. However, if you prefer your layout, it is easy to get it.

\begin{filecontents*}{NACA0012.csv}
Nr;x;y
1;1;0.00126
2;0.997596;0.001597
3;0.993757;0.002133
4;0.989627;0.002706
5;0.985199;0.003318
6;0.980473;0.003967
7;0.975459;0.004652
8;0.970173;0.005369
9;0.96464;0.006115
10;0.95889;0.006885
11;0.952954;0.007675
12;0.946864;0.008479
13;0.940648;0.009294
14;0.934333;0.010115
15;0.927938;0.010941
16;0.921483;0.011768
17;0.914981;0.012595
18;0.908444;0.013421
19;0.901878;0.014243
20;0.895292;0.015062
21;0.88869;0.015876
22;0.882076;0.016686
23;0.875452;0.017491
24;0.86882;0.01829
25;0.862183;0.019084
26;0.855541;0.019872
27;0.848896;0.020655
28;0.842247;0.021432
29;0.835596;0.022204
30;0.828943;0.022969
31;0.822288;0.023729
32;0.815632;0.024483
33;0.808974;0.025232
34;0.802315;0.025974
35;0.795655;0.026711
36;0.788994;0.027442
37;0.782333;0.028167
38;0.77567;0.028887
39;0.769008;0.0296
40;0.762344;0.030308
41;0.755681;0.03101
42;0.749017;0.031705
43;0.742353;0.032395
44;0.735688;0.033079
45;0.729024;0.033757
46;0.72236;0.034429
47;0.715695;0.035095
48;0.709031;0.035755
49;0.702368;0.036408
50;0.695704;0.037056
51;0.689041;0.037697
52;0.682379;0.038332
53;0.675717;0.03896
54;0.669056;0.039582
55;0.662396;0.040197
56;0.655736;0.040806
57;0.649078;0.041408
58;0.64242;0.042003
59;0.635764;0.042592
60;0.629108;0.043173
61;0.622454;0.043748
62;0.615802;0.044315
63;0.609151;0.044875
64;0.602501;0.045428
65;0.595853;0.045973
66;0.589207;0.046511
67;0.582562;0.047041
68;0.57592;0.047563
69;0.569279;0.048077
70;0.562641;0.048583
71;0.556005;0.049081
72;0.549371;0.04957
73;0.542739;0.050051
74;0.536111;0.050524
75;0.529484;0.050987
76;0.522861;0.051442
77;0.51624;0.051887
78;0.509623;0.052323
79;0.503008;0.052749
80;0.496397;0.053166
81;0.489789;0.053573
82;0.483185;0.05397
83;0.476584;0.054357
84;0.469987;0.054733
85;0.463394;0.055098
86;0.456805;0.055453
87;0.45022;0.055796
88;0.443639;0.056128
89;0.437063;0.056449
90;0.430492;0.056757
91;0.423925;0.057054
92;0.417364;0.057338
93;0.410807;0.05761
94;0.404256;0.057869
95;0.397711;0.058115
96;0.391172;0.058347
97;0.384638;0.058566
98;0.378111;0.05877
99;0.37159;0.058961
100;0.365076;0.059136
101;0.358569;0.059297
102;0.352069;0.059443
103;0.345577;0.059573
104;0.339092;0.059687
105;0.332616;0.059785
106;0.326148;0.059866
107;0.319689;0.059931
108;0.31324;0.059977
109;0.306799;0.060006
110;0.300369;0.060017
111;0.29395;0.060009
112;0.287541;0.059983
113;0.281144;0.059936
114;0.274759;0.05987
115;0.268386;0.059783
116;0.262026;0.059676
117;0.255681;0.059547
118;0.24935;0.059396
119;0.243034;0.059223
120;0.236735;0.059027
121;0.230453;0.058807
122;0.224189;0.058563
123;0.217944;0.058295
124;0.21172;0.058002
125;0.205518;0.057683
126;0.199339;0.057337
127;0.193185;0.056965
128;0.187058;0.056565
129;0.180961;0.056136
130;0.174894;0.05568
131;0.168862;0.055193
132;0.162867;0.054677
133;0.156913;0.054131
134;0.151004;0.053553
135;0.145144;0.052945
136;0.139338;0.052305
137;0.133592;0.051633
138;0.127913;0.05093
139;0.122309;0.050196
140;0.116787;0.049432
141;0.111357;0.048637
142;0.106028;0.047814
143;0.100812;0.046964
144;0.095719;0.046089
145;0.090761;0.045192
146;0.085949;0.044274
147;0.081294;0.04334
148;0.076804;0.042393
149;0.072489;0.041437
150;0.068354;0.040474
151;0.064404;0.039509
152;0.06064;0.038544
\end{filecontents*}
 \documentclass[11pt,a4paper]{article}
 \usepackage{csvsimple}
 \usepackage{booktabs}
 \usepackage{supertabular}
 \usepackage{siunitx}
 \begin{document}
 \twocolumn
 \tablefirsthead{%
 \toprule
 Nr. & $x/l$    &   $y/l$  \tabularnewline
 \midrule}
 \tablehead{%
 \toprule
 Nr. & $x/l$    &   $y/l$  \tabularnewline
 \midrule}
 \tabletail{\midrule}
\tablelasttail{\bottomrule}
\begin{supertabular}{r*2{S[table-format=1.6]}}
  \csvreader[ separator=semicolon,
 late after line=\\,
 ]{NACA0012.csv}{1=\Nr,2=\x,3=\y}{\Nr&\x&\y}
 \bottomrule
 \end{supertabular}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .