3

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

1 Answer 1

4

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}
1
  • I works, great. Thanks a lot for your fast answer!
    – Juhui
    Commented Aug 27, 2012 at 15:17

You must log in to answer this question.

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