2

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}
5

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}
  • strange indeed. I guess \pgfmathprintnumber also selects a font – percusse Jan 14 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.