# citations in pgfplotstable

So I'm calling data in to a pgfplotstable with

\pgfplotstabletypeset[col sep=comma]{example.txt}


which has been working fine, until I tried to include a citation in my example.txt file with \cite{somebozo}. The error message from the compiler is that there is an extra } Somewhere just after the pgfplotstabletypeset command.

Does anyone have any suggestions?

By default pgfplotstable assumes numbers, and will try to parse the content of the cells as numbers. If you set string type for the column containing the citation it seems to work fine:

\documentclass{article}
\usepackage{pgfplotstable,filecontents}
\begin{filecontents*}{example.txt}
x,y,meta
1,2,\cite{aksin}
2,3,\cite{angenendt}
3,7,\cite{doody}
\end{filecontents*}

\usepackage[backend=biber]{biblatex}
\begin{document}
\pgfplotstabletypeset[
col sep=comma,
display columns/2/.style={string type} % column count starts at 0, col 2 is third column
]{example.txt}

\printbibliography
\end{document}


I don't have a good solution for this case at the moment, though I do have a workaround. Remove the citation from the .csv file, and replace the column name for the column in question with something containing a citation.

Alternatively, if you don't need any parsing of the values in the columns, you can use the method described in https://tex.stackexchange.com/a/236364/586

There may well be better ways of doing this, but I'm not that well versed in pgfplotstable trickery.

\documentclass{article}
\usepackage{pgfplotstable,filecontents}
\begin{filecontents*}{example.txt}
x,y,whatever % note no citation here
1,2,\cite{aksin}
2,3,\cite{angenendt}
3,7,\cite{doody}
\end{filecontents*}
\begin{filecontents*}{example2.txt}
x,y,meta\cite{glashow}
1,2,\cite{aksin}
2,3,\cite{angenendt}
3,7,\cite{doody}
\end{filecontents*}
\usepackage[backend=biber]{biblatex}
\begin{document}
\pgfplotstabletypeset[
col sep=comma,
display columns/2/.style={string type},
every col no 2/.style={column name={meta\cite{glashow}}} % redefine column name
]{example.txt}

\pgfplotstabletypeset[
col sep=comma,