I am a beginner in LaTeX, experimenting with industrial documents. I cannot find the suitable code to solve some of the problems below:
- I would like to be able to sort the table, but excluding the final row, supposed to be a summary.
- I could not find how to apply the
fixed, zerofill, dec sep align, precision=2parameters to all columns but the first. - I could not make the code for bold fonts in the last row to work.
\documentclass{article}
\usepackage{colortbl,hhline}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{filecontents}
\usepackage{booktabs}
\begin{filecontents}{data.csv}
{Items},{Rating},{Design 1},{Design 2},{Design 3}
Design complexity, 6.3,3.5, 8.5, 8.12
Cost,9.2, 3.8, 5.77, 5.9
Energy consumption,6.62,4.8, 8.1,9.5
Average weighted normalized,, 3.7, 7.92,7.35
\end{filecontents}
\begin{document}
\pgfplotstableread[col sep=comma]{data.csv}{\datatable}
\centering
\pgfplotstabletypeset[font=\small,
every even row/.style={
before row={\rowcolor[gray]{0.9}}},
every head row/.style={
before row=\toprule,after row=\midrule},
every last row/.style={
after row=\bottomrule},
%every first column/.style={string type},%does not work
columns/Items/.style={string type}, %works
column 2/.style={fixed, zerofill, dec sep align, precision=2}, %does not work
every last column/.style={fixed, zerofill, dec sep align, precision=1},
%sort, sort key={Design 2}, %Works but should not include last row
%sort cmp={float >}, %Works but should not include last row
every first column/.style={column type={l}}, %Does not work
every head row/.style={
before row={\toprule},
after row=\midrule
},
every last row/.style={before row={\bottomrule},
after row={\bottomrule},
postproc cell content/.style={@cell content=\textbf{##1}}}, %does not work
]{\datatable}
\end{document}
every first column: it worked for me (except that you declare it twice which essentially overwrites the first declaration). And it is evaluated in the very same place ascolumns/Items/.style, i.e. there should be no difference. – Christian Feuersänger Aug 04 '12 at 09:41