Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Following this question:

Multiple Multi columns with pgfplotstable

The first row of my data gets messed up somehow, here's the code:

\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage[paperwidth=35cm]{geometry}

\begin{document}

\noindent\pgfplotstabletypeset[
 every head row/.style={
 before row={\toprule
   &
       &\multicolumn{2}{c}{32-2}
   &\multicolumn{2}{c}{128-4}
   &\multicolumn{2}{c}{256-8}
   &\multicolumn{2}{c}{32-4 w/o LS}
   &\multicolumn{2}{c}{128-4 w/o LS}
   &\multicolumn{2}{c}{256-8 w/o LS}
    },
},
display columns/1/.style={column name={Instance}},
display columns/2/.style={column name={n}},
display columns/3/.style={column name={Avg. Time}},
display columns/4/.style={column name={Avg. Qual.}},
display columns/5/.style={column name={Avg. Time}},
display columns/6/.style={column name={Avg. Qual.}},
display columns/7/.style={column name={Avg. Time}},
display columns/8/.style={column name={Avg. Qual.}},
display columns/9/.style={column name={Avg. Time}},
display columns/10/.style={column name={Avg. Qual.}},
display columns/11/.style={column name={Avg. Time}},
display columns/12/.style={column name={Avg. Qual.}},
display columns/13/.style={column name={Avg. Time}},
display columns/14/.style={column name={Avg. Qual.}},
every last row/.style={after row=\bottomrule},
string type
]
{
bur26a 26 94.6513 0.9995 145.6622 0.9999 202.7375 1.0000 1.4381 0.9707 2.0208 0.9770 2.9439 0.9786
chr25a 25 84.5684 0.8296 131.5305 0.8881 183.0491 0.9012 1.4192 0.3110 1.9670 0.3369 2.8968 0.3530
}

\end{document}

The bunch of &'s near the multicolumns is a hack i found to properly align them to their respective pair of columns.

Those columns style lines are there to make columns have the same name.

Output is this:

Table Output

Note how the first row isn't there, and there is a bur26a where it shouldn't.

Help? Thanks.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

If the first row of your data table contains non-numeric entries, PGFPlotstable assumes that it contains the column names. To switch this off, set header=false.

The columns numbering starts with 0, not 1, which explains your offset.

If you introduce a row above your header row using before row, you'll need to terminate that row using \\.

\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage[paperwidth=35cm]{geometry}

\begin{document}

\noindent\pgfplotstabletypeset[
 every head row/.style={
 before row={\toprule
   &
   &\multicolumn{2}{c}{32-2}
   &\multicolumn{2}{c}{128-4}
   &\multicolumn{2}{c}{256-8}
   &\multicolumn{2}{c}{32-4 w/o LS}
   &\multicolumn{2}{c}{128-4 w/o LS}
   &\multicolumn{2}{c}{256-8 w/o LS}\\
  },
 after row=\midrule
},
display columns/0/.style={column name={Instance}},
display columns/1/.style={column name={n}},
display columns/2/.style={column name={Avg. Time}},
display columns/3/.style={column name={Avg. Qual.}},
display columns/4/.style={column name={Avg. Time}},
display columns/5/.style={column name={Avg. Qual.}},
display columns/6/.style={column name={Avg. Time}},
display columns/7/.style={column name={Avg. Qual.}},
display columns/8/.style={column name={Avg. Time}},
display columns/9/.style={column name={Avg. Qual.}},
display columns/10/.style={column name={Avg. Time}},
display columns/11/.style={column name={Avg. Qual.}},
display columns/12/.style={column name={Avg. Time}},
display columns/13/.style={column name={Avg. Qual.}},
every last row/.style={after row=\bottomrule},
string type,
header=false
]
{
bur26a 26 94.6513 0.9995 145.6622 0.9999 202.7375 1.0000 1.4381 0.9707 2.0208 0.9770 2.9439 0.9786
chr25a 25 84.5684 0.8296 131.5305 0.8881 183.0491 0.9012 1.4192 0.3110 1.9670 0.3369 2.8968 0.3530
}

\end{document}
share|improve this answer
    
Thanks, that solved it. I asked myself if it started with 0 or 1, now I know. –  polar Dec 4 '12 at 17:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.