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

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
    Feb 8 '18 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. Feb 8 '18 at 10:28
  • Tank you for the answer! :-)
    – baghira
    Feb 13 '18 at 8:36

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.