1

I am trying to sort a table I created with the pgfplotstable package and I can't find out why it is not working.

\pgfplotstableset{col sep=semicolon, use comma, fixed, set thousands separator={}}
\pgfplotstableread
{
Matrikelnummer;Note     
1010123;1.4
1010121;2.3
1010122;1.1
}\loadedtable

\pgfplotstabletypeset[sort, sort key={Matrikelnummer}]\loadedtable

When I change the sort key to "Note" it works like a charm. But the example above simply does not change the order.

1 Answer 1

1

If you set sort cmp={int <} it works fine.

sorted table

\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableset{col sep=semicolon, use comma, fixed, set thousands separator={}}
\pgfplotstableread
{
Matrikelnummer;Note     
1010123;1.4
1010121;2.3
1010122;1.1
}\loadedtable

\pgfplotstabletypeset[sort,sort cmp={int <},sort key=Matrikelnummer]\loadedtable

\end{document}
3
  • What does this addition do? I assume int is the short term for integer. Does this compare parameter defines that it is an integer?
    – baghira
    Commented Feb 8, 2018 at 10:21
  • @baghira Yes, int is for integer. It tells pgfplotstable what kind of comparison function to use for the sorting, and int < expects integer values as inputs. The default is float <, which expects floats as inputs, and that didn't seem to work for your integers. Commented Feb 8, 2018 at 10:28
  • Tank you for the answer! :-)
    – baghira
    Commented Feb 13, 2018 at 8:36

You must log in to answer this question.

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