In the documentation for the pgfplotstable package you can find the following in the introduction:
Key-value pairs can be set in two ways:
- As default settings for the complete document (or maybe a part of the document), using
\pgfplotstableset{⟨options⟩}. For example, the document’s preamble may contain \pgfplotstableset{fixed zerofill,precision=3}
to configure a precision of 3 digits after the period, including zeros to get exactly 3 digits for all fixed point numbers.
The or maybe a part of the document is what I am interested in.
I have different \pgfplotstableset{⟨options⟩}
defined via \newcommand
and intended to switch between them as needed (more or less for each table). Sadly I have not really been able to get this to work.
- Is this possible at all?
- Could you point me to an example document where it has been done?
Thanks!
I will try to explain a bit more in detail what my problem is.
In the preamble I have created multiple new commands such as:
\newcommand{\CCforTABSTable}{\pgfplotstableset{
reset styles,
disable rowcol styles=false,
col sep=&,
header=false,
% precision=2,
% row sep=\\,
columns={0, 5, 8},
columns/0/.style={reset styles,string type,column type={L{.5\linewidth}}, column name={Location}},
columns/5/.style={reset styles,string type,column type={C{.1\linewidth}}, column name={0d}},
columns/8/.style={reset styles,string type,column type={C{.1\linewidth}}, column name={1d}},
begin table=\begin{longtable},
every first row/.append style={ %
before row={\midrule
\endfirsthead
\multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
},
},
end table=\end{longtable},
}
}
and
\newcommand{\IDATableTypeT}{\pgfplotstableset{ %Type T
reset styles,
disable rowcol styles=true,
header=true,
precision=2,
create on use/thiws/.style={create col/expr={(\thisrow{thiws1}+\thisrow{thiws2}+\thisrow{thiws3}+\thisrow{thiws4})/4}},
create on use/thiw/.style={create col/expr={(\thisrow{thiw1}+\thisrow{thiw2}+\thisrow{thiw3}+\thisrow{thiw4})/4}},
%
columns={time, thwaterin, thwaterout, thf, thp, thc, thiws, thiw, tha, thmr, thop},
columns/time/.style={column name={Step}, fixed},
columns/thwaterin/.style={column name={$\tHWaterIn$}, fixed zerofill, precision=1, fixed},
columns/thwaterout/.style={column name={$\tHWaterOut$}, fixed zerofill, precision=1, fixed},
columns/thf/.style={column name={$\tHF$}, fixed zerofill, precision=1, fixed},
columns/thp/.style={column name={$\tHP$}, fixed zerofill, precision=1, fixed},
columns/thc/.style={column name={$\tHC$}, fixed zerofill, precision=1, fixed},
columns/thiws/.style={column name={$\tHIws$}, fixed zerofill, precision=1, fixed},
columns/thiw/.style={column name={$\tHIw$}, fixed zerofill, precision=1, fixed},
columns/tHA/.style={column name={$\tHA$}, fixed zerofill, precision=1, fixed},
columns/thmr/.style={column name={$\tHMr$}, fixed zerofill, precision=1, fixed},
columns/thop/.style={column name={$\tHOp$}, fixed zerofill, precision=1, fixed},
% row sep=\\,
begin table=\begin{longtable},
every first row/.append style={ %
before row={\midrule
\endfirsthead
\multicolumn{10}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
},
},
end table=\end{longtable},
}
}
In the main document I now have first:
\CCforTABSTable
\pgfplotstabletypeset[every head row/.append style={before row={%
\caption{Case: bla} %
\label{tab:test}\\ %
\toprule},}
] {\CCData/results/1318AaBb-1day.txt}
and the later:
\IDATableTypeT % defined in pgfplots.tex
\pgfplotstabletypeset[every head row/.append style={before row={%
\caption{jaja} %
\label{tab:11855-4_HighWallHeatCond_TypeT}\\ %
\toprule},}
] {\IDAData/11855-4_HighWallHeatCond.prn}
Until now I have gotten different errors but the one that I do not understand is this one:
PGFPlots: reading {Data/IDA/11855-4_HighWallHeatCond.prn}
./SimplyTabs/Appendix/ValidationIDA.tex:14: Package pgfplots Error: Sorry,
could not retrieve column 'time' from table 'Data/IDA/11855-4_HighWallHeatCond.prn'.
Please check spelling (or introduce name aliases)..
However the file reads:
time order qhc qhcirc qhcontot qhf qhiws1 qhiws2 qhiws3 qhiws4 qhradtot tha thc thf thiw1 thiw2 thiw3 thiw4 thiws1 thiws2 thiws3 thiws4 thmr thmrandt_1 thmrandt_2 thop thp thwaterin thwaterout
4679.000000 1.0000 209.93 -880.68 30.000 32.953 -20.663 -17.220 -20.663 -17.220 10.000 23.330 21.846 22.378 22.902 22.902 22.902 22.902 22.900 22.900 22.900 22.900 22.481 23.330 -7.1583 22.763 21.232 20.000 20.707
4680.000000 1.0000 125.03 -799.28 30.000 5.0923 -20.864 -17.386 -20.864 -17.386 10.000 22.306 21.584 22.096 22.397 22.397 22.397 22.397 22.395 22.395 22.395 22.395 22.105 22.306 -7.1583 22.202 21.110 20.000 20.637
Best Answer
If you don't find a reset style key, I recommend you define the stles you want to apply to all tables, for instance:
and prepare different styles for the various things you want to control:
Code: