3

I have some data in a csv file I wanted to turn into a table, but pgfplotstable does not print any string type values. All I'm getting is the numbers, but I also need those string values.

The example is from here.

table with stuff missing

MWE:

\documentclass{article}

\listfiles
\usepackage{filecontents}
\usepackage{pgfplotstable}

\begin{filecontents}{data.csv}
Name,Surname,Age
Albert,Einstein,133
Marie,Curie,145
Thomas,Edison,165
\end{filecontents}

\begin{document}

\begin{tikzpicture}
\pgfplotstabletypeset[
    col sep=comma,
    header=has colnames,
    columns={Name,Surname,Age},
    columns/Name/.style={column type={c|},string type},
    columns/Surname/.style={column type={c|},string type}, 
]{data.csv}

\end{tikzpicture}
\end{document}

1 Answer 1

6

This happens because you're wrapping the \pgfplotstabletypeset command in a tikzpicture (I'm surprised that there is any output at all). Remove the tikzpicture, or put the \pgfplotstabletypeset command in a \node:

\documentclass{article}

\listfiles
\usepackage{filecontents}
\usepackage{pgfplotstable}

\begin{filecontents}{data.csv}
Name,Surname,Age
Albert,Einstein,133
Marie,Curie,145
Thomas,Edison,165
\end{filecontents}

\begin{document}
\pgfplotstabletypeset[
    col sep=comma,
    header=has colnames,
    columns={Name,Surname,Age},
    columns/Name/.style={column type={c|},string type},
    columns/Surname/.style={column type={c|},string type}, 
]{data.csv}
\end{document}
1
  • strange indeed. I guess \pgfmathprintnumber also selects a font
    – percusse
    Jan 14, 2014 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .