I have some x y data that I wish to typeset using pgfplotstable
, rather than having say 9 rows of 2 columns, I would like to have 3 rows, with 3 sets of xy pairs.
Consider the following:
\documentclass{article}
\usepackage{pgfplotstable,filecontents}
\begin{filecontents}{mydata.dat}
x y x y x y
0 0 3 3 6 6
1 1 4 4 7 7
2 2 5 5 8 8
\end{filecontents}
\begin{document}
\pgfplotstableset{
columns/x/.style={
column name={$X$},
},
columns/y/.style={
column name={$Y$},
column type/.add={}{|}
},
}
\pgfplotstableread{mydata.dat}\loadedtable
\pgfplotstabletypeset{\loadedtable}
\end{document}
Which produces the following output:
Clearly columns 2 to 6, in this MWE are not being typeset as desired. I am aware that this can be resolved by declaring unique column style for each column as follows:
\pgfplotstableset{
columns/A/.style={
column name={$X$},
},
columns/B/.style={
column name={$Y$},
column type/.add={}{|}
},
columns/C/.style={
column name={$X$},
},
columns/D/.style={
column name={$Y$},
column type/.add={}{|}
},
columns/E/.style={
column name={$X$},
},
columns/F/.style={
column name={$Y$},
column type/.add={}{|}
},
}
Also slightly modifying the input data structure:
\begin{filecontents}{mydata.dat}
A B C D E F
0 0 3 3 6 6
1 1 4 4 7 7
2 2 5 5 8 8
\end{filecontents}
Producing the desired format, with column names [X Y X Y X Y]:
But I am trying to avoid having to effectively re-type the same code over and over. How can I use the same pgfplotstableset
column style, for multiple columns in the same table.
X Y X Y X Y
, correct? – Jake Oct 24 '13 at 19:39