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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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}
share|improve this answer
    
I works, great. Thanks a lot for your fast answer! – Juhui Aug 27 '12 at 15:17

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.