I am trying to create a table with data from a .xslx file exported to .csv with pgfplotstable but I have trouble with the percentage sign. One of the columns in the header includes the percentage character and I keep getting the error
! Missing \endcsname inserted.
but this error only occurs when I try to name a header column with the percentage character (which is what I want!)
I am trying to get something like
--------------------
Data 2% Compare
--------------------
Data1 1 2
Data2 3 4
--------------------
MWE that works: (Notice placement of \%)
\begin{filecontents*}{test01.csv}
Data, 2, Compare
Data1, 1\%, 2
Data2, 3, 4
\end{filecontents*}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\begin{document}
\pgfplotstabletypeset[
col sep=comma,
string type,
every head row/.style={before row=\toprule,after row=\hline},
every last row/.style={after row=\hline},
]{test01.csv}
\end{document}
MWE that does not work:
\begin{filecontents*}{test001.csv}
Data, 2\%, Compare
Data1, 1, 2
Data2, 3, 4
\end{filecontents*}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\begin{document}
\pgfplotstabletypeset[
col sep=comma,
string type,
every head row/.style={before row=\toprule,after row=\hline},
every last row/.style={after row=\hline},
]{test001.csv}
\end{document}
As suggested by @egreg I have tried \begingroup\makeatletter\@makeother\% before \pgfplotstabletypeset but this does not work for the percentage character.
2\%is being used as a column name. – Andrew Swann Feb 13 '15 at 11:58column/<column name>/column name=2\%where column name being whatever you wish2p,2etc. – percusse Feb 13 '15 at 12:07columns/2p/.style={column name={2\%}? This seems to work! – Therkel Feb 13 '15 at 12:58