I'm trying to encapsulate some pgfplotstable code that involves setting up a row predicate. If you are checking table values amongst the predicate code you need access to the table and the only thing that seems to work here is hardwiring the command name of the loaded table, which does not lend itself to code reuse, and there are also other aspects of the style that change on a case by case basis. But, if you put this stuff inside a macro, there ends up being confusion about whose #1 is whose, given that writing the code for a row predicate involves distinguishing between the immediate parameter #1 for the style and the delayed parameter '##1' for the row number when the code is actually used.

  • Wow, nobody liked this question. Is it such a bad idea? Nov 25, 2014 at 22:19

1 Answer 1


The following example call, \mysetpredicate, shows that you have to double up on the hashes. Four, for what will become two in the predicate itself to get the row number. Two, for what will become one to get the style parameter and one for the parameter to the wrapping function. I was surprised that I could just pass the file link in as is. I originally assumed I couldn't and wasted a lot of time trying all kinds of tricky stuff that didn't work. First build your table with either pgfplotsreadtablenew or pgfplotsreadtableread then call \mysetpredicate{\mytable} before calling \pgfplotstabletypeset.

        /pgfplots/table/select rows/.style={%
            row predicate/.code={%
                \else\advance\myrowtally by 1

You must log in to answer this question.

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