6

I have the following csv file:

0.000000000000000000e+00 -2.485778083899142232e-01 -6.775462378935208640e-01 1.687203134856525066e+00 2.019105909655298348e+00
1.000000000000000000e+00 -1.017956330703129603e-01 1.041265073352016346e+00 -2.052873217030770914e-01 -7.845350358011289327e-01
2.000000000000000000e+00 -2.044778046740177491e+00 1.814382952270155114e+00 -4.107096548840479810e-01 -7.266081915530832325e-02
3.000000000000000000e+00 1.728711794852572370e-01 1.806469649168314651e-01 -2.106129980613406172e+00 -9.250578695477212898e-01

which I convert in to a LaTex table with

\documentclass{article}

\usepackage{pgfplotstable}
\usepackage{array}
\usepackage{amsmath}

\begin{document}

\begin{table}
\centering
\pgfplotstabletypeset[%
   fixed zerofill,
   col sep=space,
   dec sep align,
   columns/0/.style ={column name=},
   columns/1/.style ={column name=transition, precision=1},
   columns/2/.style ={column name=int(abs.)},
   columns/3/.style ={column name=int(comp.)},
   columns/4/.style ={column name=example},
]{mydata.csv}
\end{table}

\end{document}

resulting in

table

Now I want the first column to show

enter image description here

How can I add the $\leftarrow$0 to each row? I've tried with

postproc cell content/.append style={/pgfplots/table/@cell content/.add={$}{\leftarrow 0$}

but there's still an error when compiling the file.


Meanwhile I managed to compile the file

\documentclass{article}

\usepackage{pgfplotstable}
\usepackage{array}
\usepackage{amsmath}

\begin{document}

\begin{table}
\centering
\pgfplotstabletypeset[%
   fixed zerofill,
%   precision=4,
   col sep=space,
   dec sep align,
   columns/0/.style ={
    column name=,
    precision=0,
    postproc cell content/.append style={
         /pgfplots/table/@cell content/.add={}{ $\leftarrow 0$}
    }
   },
   columns/1/.style ={column name=transition, precision=1},
   columns/2/.style ={column name=int(abs.)},
   columns/3/.style ={column name=int(comp.)},
   columns/4/.style ={column name=example},
]
{mydata.csv}
\end{table}

\end{document}    

enter image description here

So, how do I get rid of the doubled formatting? Is this a result of the number formatting in the csv?

  • 2
    Welcome to TeX.SX! Can you please include the postproc line where you have done so in the MWE you posted? Can you also paste the error text into your question? – darthbith Oct 28 '14 at 16:10
  • I've updated the question with my attempt. – tmartin Oct 29 '14 at 10:25
3

The double arrows are a side-effect of dec sep align: the feature is a relatively stupid thing which results in two cells (one for the part before the decimal separator and one cell after it).

In your case, the solution appears to be to configure dec sep align only for columns which really need it:

\documentclass{standalone}

\usepackage{pgfplotstable}
\usepackage{array}
\usepackage{amsmath}

\begin{document}

\pgfplotstabletypeset[%
   fixed zerofill,
%   precision=4,
   col sep=space,
   columns/0/.style ={
    column name=,
    precision=0,
    postproc cell content/.append style={
         /pgfplots/table/@cell content/.add={}{ $\leftarrow 0$}
    }
   },
   columns/1/.style ={dec sep align,column name=transition, precision=1},
   columns/2/.style ={dec sep align,column name=int(abs.)},
   columns/3/.style ={dec sep align,column name=int(comp.)},
   columns/4/.style ={dec sep align,column name=example},
]
{
0.000000000000000000e+00 -2.485778083899142232e-01 -6.775462378935208640e-01 1.687203134856525066e+00 2.019105909655298348e+00
1.000000000000000000e+00 -1.017956330703129603e-01 1.041265073352016346e+00 -2.052873217030770914e-01 -7.845350358011289327e-01
2.000000000000000000e+00 -2.044778046740177491e+00 1.814382952270155114e+00 -4.107096548840479810e-01 -7.266081915530832325e-02
3.000000000000000000e+00 1.728711794852572370e-01 1.806469649168314651e-01 -2.106129980613406172e+00 -9.250578695477212898e-01
}

\end{document} 

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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