This question already has an answer here:

I have to do a lot of certificates and I have a list of names, every name has a characteristic (A,B or C). I have designed the whole structure for the certificate and have the 'name' and 'characteristic' in blank.

My question is if it is possible to do something like

while (i in list):
 code for structure with line name = i and charactertistic = char[i]

In LaTeX, I mean writing the list and their characteristic in the code.

marked as duplicate by Werner, Jesse, Mensch, barbara beeton, Zarko Aug 10 '16 at 17:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Here I applied something like a hash-table, using name/characteristics as a bundled pair and splitting them with a small helper macro, setting the name as a property key and the characteristics as the key value.

The iteration about all keys is done with \prop_map_inline.

Some important notes:

  • The keys must be unique -- specifying them again will just overwrite the old value.
  • The order of appearance is not necessarily the same as the order of specification!



\prop_new:N \l_felipe_prop_list 

  \prop_put:Nnn \l_felipe_prop_list {#1} {#2}

  \seq_set_from_clist:Nn \l_tmpa_seq {#1}
  \seq_map_inline:Nn \l_tmpa_seq {%
    \helpercmd ##1 % Splitting!

  \prop_map_inline:Nn \l_felipe_prop_list {%
    \displaynamechar{##1}{##2}% using a specialized display macro

% Change the `\displaynamechar` macro at will: #1 -> key name, #2 -> key value
  Name = #1 \hfill Characteristics: #2%


\fillproplist{Gandalf/A, Frodo/B, Sauron The Dark Lord/C}


enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.