[Tex/LaTex] column separator in header line in column with dec sep align

pgfplotstable

I'd like to have a column with vertical bar separators. When I set the number format to 'dec sep align' the vertical separators disappear. Here is a MWE:

\documentclass{article}
\usepackage{array}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5.1}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset
    [columns/A/.style={column type={|r|}},
     columns/B/.style={dec sep align, column type/.style={|}{|}},
     columns/C/.style={dec sep align, column type/.style={|}{|}},
     outfile=TestTable.tex
    ]{
      A    B     C
     1  1.23  1.23
     20 3.4   5.654
    }
\end{document}

In the generated code, indeed I don't see my vertical bars:

\begin {tabular}{|r|r<{\pgfplotstableresetcolortbloverhangright }@{}l<{\pgfplotstableresetcolortbloverhangleft }r<{\pgfplotstableresetcolortbloverhangright }@{}l<{\pgfplotstableresetcolortbloverhangleft }}%
A&\multicolumn {2}{c}{B}&\multicolumn {2}{c}{C}\\%
\pgfutilensuremath {1}&$1$&$.23$&$1$&$.23$\\%
\pgfutilensuremath {20}&$3$&$.4$&$5$&$.65$\\%
\end {tabular}%

What am I doing wrong?

Thanks
Juhui

Best Answer

You have to use column type/.add={}{|}, not /.style. Also, for the vertical lines to work with the header row of the aligned columns, you'll have to use dec sep align={c|}.

\documentclass{article}
\usepackage{array}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5.1}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset
    [columns/A/.style={column type={|r|}},
     columns/B/.style={dec sep align={c|}, column type/.add={}{|}},
     columns/C/.style={dec sep align={c|}, column type/.add={}{|}},
    % outfile=TestTable.tex
    ]{
      A    B     C
     1  1.23  1.23
     20 3.4   5.654
    }
\end{document}