# Manually add a literal column to a table loaded from a file

I would like to use pgfplotstable to typeset some numbers stored in a text file. I have used \pgfplotstableread to achieve that and it worked all right. Now I want to add a column to the said table that contains literal entries, or more precisely mathematical entries. I think I should use something like create on use or \pgfplotstablecreatecol but I am a little confused about how to actually do it. Do you know how I could transform this

into this

The previous picture were obtained with the following code :

\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{colortbl}

\begin{document}

\begin{table}
\centering
\begin{tabular}{cccccc}\toprule
& $c_0$     & $c_1$ \\
$u \times 10^2$ & -3.8682 & 1.5055   \\
$v \times 10^6$ & 2.1272  & -8.3619  \\
$w \times 10^3$ & 1.1862  & -4.6269  \\\bottomrule
\end{tabular}
\caption{It should eventually look like this.}
\end{table}

\begin{table}

-3.8682 1.5055
2.1272 -8.3619
1.1862 -4.6269
}\tabledon

\centering
before row={%
\toprule}},
every last row/.style={
after row=\bottomrule},
display columns/0/.style={column name={$c_0$}},
display columns/1/.style={column name={$c_1$}},
/pgf/number format/precision=4,
columns
]{\tabledon}
\caption{This is my current attempt.}
\end{table}

\end{document}

-
If you load a table from a file, do you know how many rows are there? Where do you get to know what should be in the inserted column - from another file, or are there exactly 3 rows always and you know they should be marked this way? – yo' Aug 27 '12 at 18:33
I know the number of rows and exactly what should go in every cell of the first column. – Alfred M. Aug 28 '12 at 6:13

You can use the create col/set list style for supplying the list of cells:

\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}

\begin{document}

-3.8682 1.5055
2.1272 -8.3619
1.1862 -4.6269
}\tabledon

\pgfplotstabletypeset[
before row={%
\toprule
}
},
every last row/.style={
after row=\bottomrule
},
display columns/0/.style={column name={}},
display columns/1/.style={column name={$c_0$}},
display columns/2/.style={column name={$c_1$}},
/pgf/number format/precision=4,
create on use/newcol/.style={
create col/set list={$u \times 10^2$,$v \times 10^6$,$w \times 10^3$}
},
columns/newcol/.style={string type},
columns={newcol,0,1}
]{\tabledon}

\end{document}

-
thanks for your answer, that was very useful! – Denis Jul 14 '14 at 13:39