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.

I am stacking one header by using this macro: \newcommand*{\textstackrel}[2]{\ensuremath{\stackrel{\hbox{#1}}{\hbox{#2}}}}. This makes the other single line headers bottom aligned, which looks bad.

So I tried a few multirow tricks I know to no avail, e.g.: assign column name/.code={\multicolumn{1}{c}{\multirow{2}{*}{#1}}}

Most of the time I ran into this error message:

! siunitx error: "duplicate-exponent-token"
! Duplicate exponent marker token '\token_to_str:N d' in input.

How do I do this correctly?

PS: MWE will follow when I have (more) time and if there is no answer before that.

share|improve this question
    
I think you do need to provide some more information: Why do you get siunitx errors if you're not using the S column type? –  Jake Dec 14 '12 at 7:06
    
The column types for the actual cells are of course S. Unfortunately I can not reproduce the error I had. On the positive side, I will post a solution for the original problem in a few :) –  stefanct Dec 15 '12 at 14:06

1 Answer 1

up vote 2 down vote accepted

While preparing the MWE I have found a possible solution. Feel free to improve it or post another one.

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

\begin{document}

\pgfplotstableread{
size        min         max         avg         med
1           2e-03       3e-03       2.5e-03     2.4e-03
10          2.02e-03    3.02e-03    2.72e-03    2.32e-03
123456789   2.02        123.72e9    2.72e9      2.32e-03
}{\loadedtable}

\pgfplotstableset{
    begin table=\begin{longtable},
    end table=\end{longtable},
}
\sisetup{
    table-format = 3.2e+3,
    round-precision=2,
    round-mode=places,
    scientific-notation=engineering,
    group-digits=integer,
    group-separator={,},
    exponent-product = \cdot,
}

\pgfplotstabletypeset[
    header=true,
    string type,
    multicolumn names,
    columns={size,med,min,avg,max},
    assign column name/.code={%
        \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{1}{c}{\multirow{2}{*}{#1}} }%
    },
    columns/size/.style ={column name={\shortstack{Instance\\Size}}, column type={S[scientific-notation=false,table-format=9]}, int detect},
    columns/min/.style ={column name=Minimum,   column type=S},
    columns/avg/.style ={column name=Average,   column type=S},
    columns/med/.style ={column name=Median,    column type=S},
    columns/max/.style ={column name=Maximum,   column type=S},
    every head row/.style={before row=\toprule, after row=\\\midrule\endhead},
    every last row/.style={after row=\bottomrule},
]{\loadedtable}

\end{document}

The important bits are:

  • to use \pgfkeyssetvalue in assign column name/.code, and
  • the additional \\ line break in after row in the every head row style.

share|improve this answer
1  
Looks good! I would probably use \shortstack{Instance\\Size} instead of the \textstackrel macro. –  Jake Dec 15 '12 at 14:46
    
Thanks, edited. –  stefanct Dec 15 '12 at 15:11

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.