3

I would like to implement a multicolumn table with Pgfplotstable that aligns on one side the number of the columns by dec sep align and secondly aligns the whole table by Tabularx. A version without Tabularx can be seen below:

Example without Tabularx

Similar questions have been asked Dec sep align & \multicolumn incompatibility? and here Setting table width with pgfplotstable. However, the combination of both have never been asked and seems to make troubles by generating error messages (misplaced noalign).

Sample code for the current table can be found below:

\pgfplotstabletypeset[
    col sep=comma, 
    header=false,
    % column type=,
    % begin table={\begin{tabularx}{\textwidth}{XXXXXXXXXX}},
    % end table={\end{tabularx}},
    every head row/.style={
        before row={\toprule%
            \multicolumn{1}{l}{Test Case}  & 
            \multicolumn{6}{c}{Extraction Times (ms)} & 
            \multicolumn{6}{c}{Nr. of Nodes} &  
            \multicolumn{6}{c}{Nr. of Edges}\\
        }, after row={\midrule}
    },
    every last row/.style={after row=\bottomrule},
    display columns/0/.style={column name={}, string type, column type={l}},
    display columns/1/.style={column name={Avg.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/2/.style={column name={Min.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/3/.style={column name={Max.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/4/.style={column name={Avg.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/5/.style={column name={Min.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/6/.style={column name={Max.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/7/.style={column name={Avg.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/8/.style={column name={Min.}, fixed, fixed zerofill, precision=3, dec sep align={l}},
    display columns/9/.style={column name={Max.}, fixed, fixed zerofill, precision=3, dec sep align={l}},                         
]
{
1,0.9010122055414193,0.026615,63.07629,77.97766468758836,25,237,76.97766468758836,24,236
2,0.8516347167090754,0.015717,98.322158,29.500989539157477,9,86,28.500989539157477,8,85
3,0.8279668317783433,0.012067,46.588329,15.549901046084253,5,44,14.549901046084253,4,43
4,0.8110630712468193,0.010986,46.879446,10.682499293186316,4,30,9.682499293186316,3,29
}

I have already changed the number of columns of the tabularx as doc sec align needs two columns without any success.

Any suggestions and solutions are highly appreciated.

  • Could you please complete your MWE with your documentclass and page setting? Your table goes behind the borders of an ordinary article class. – CarLaTeX Jun 3 '18 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.