I'm using the arrayjobx to store data in arrays, and I want to search through those arrays.

For example, I might have a list of names and places and I want to search through those names to find the index of a given name in that array.


I want something like \findindex so that I can call the place associated to the person, e.g.


should output Bangkok.

How might I do this?

  • I'm not sure that arrayjobx is able to retrieve the index of an entry, without doing a loop over the whole array. Are you tied to arrayjobx or would you accept other solutions?
    – egreg
    May 21 '15 at 17:45
  • I'd accept other solutions. Is there a good alternative to arrayjobx here? I did eventually figure out how to do a loop through the whole array to find the index, which solved my problem, though. May 22 '15 at 19:45

You probably want a property list, rather than two independent arrays.


  \prop_gput:Nnn \g_luftbahn_person_place_plist { #1 } { #2 }

  \prop_item:Nn \g_luftbahn_person_place_plist { #1 }

\prop_new:N \g_luftbahn_person_place_plist



Bob lives in \Place{Bob}.


enter image description here

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.