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.


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

| improve this answer | |

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