3

In some codes I encountered some \z command, for example:

\pgfmathrandomitem\z{mylist}\z\prunelist{mylist}

from this question: Generating random numbers without repetitions. What exactly does it mean?

  • It's simply the name of a macro. – Gonzalo Medina Jan 30 '15 at 18:30
  • just a macro? but if you look at the accepted answer of the linked question, there is no definition of \z... and the code, cut-and-pasted on my editor, works – user126154 Jan 30 '15 at 18:33
  • \pgfmathrandomitem internally makes the necessary definition. – Gonzalo Medina Jan 30 '15 at 18:34
  • The answer is not accepted, as there's no check by it, @user126154. I'd strongly suggest you mark it as such – hd1 Jan 30 '15 at 22:08
  • @hd1 The user was referring to 'the accepted answer of the linked question', and the linked question not only has an accepted answer. It isn't the OP's question in any case, so they couldn't accept an answer if they wanted to. – cfr Jan 31 '15 at 02:23
  • @user126154 \z is a control sequence which is very often preferred by @DavidCarlisle . – wipet Jan 31 '15 at 07:03

1 Answers1

9

It's nothing more than a standard macro. Instead of \z you could have used \xxxyyy or any other valid macro name.

The line

\pgfmathrandomitem\z{mylist}

simply selects an item from the mylist list and stores it in the macro \z.

Then

\z\prunelist{mylist} 

shows the item stored in \z and removes it from the list.

azetina
  • 28,884
Gonzalo Medina
  • 505,128