0

I have encountered the following. What are keys about and how are they to be used, for what purpsose. Could I have some examples ?

\keys_define:nn { feuds_teorema_keys }
  {
    name .tl_set:N = \feuds_teorema_name_tl,
    label .tl_set:N = \feuds_teorema_label_tl,
    shared .tl_set:N = \feuds_teorema_shared_tl,
    parent .tl_set:N = \feuds_teorema_parent_tl,
    pigment .tl_set:N = \feuds_teorema_pigment_tl,
  }
Veak
  • 1
  • 1
    keys allow syntax such as \includegraphics[width=3cm, clip=false]{somefile} with the values (for width and clip here) being saved as macros and passed to the implementation of the main macro (\includegraphics here). \includegraphics uses an older key system (keyval package) but idea is basically the same. – David Carlisle Sep 28 '23 at 18:54
  • 1
    Hi, if you don't have a specific problem, I recommend reading the interface3 doc, p. 233 ff. If you have a particular use case, post a MWE and tell us what you want to achieve ;) – lukeflo Sep 28 '23 at 18:57
  • I am trying to understand the code. Is it correct to say that when the key name is used, its value is assigned to the token list variable \feuds_teorema_name_tl ? – Veak Sep 28 '23 at 19:10
  • Does one require the last comma in \feuds_teorema_pigment_tl, ? – Veak Sep 28 '23 at 19:11
  • When the key name=Jane is used, the value Jane is assigned to the token list. The last comma is not necessary, but better an extra comma than a missing one – lukeflo Sep 28 '23 at 19:17
  • Meaning that width and clip would then correspond to name and label in the aforementioned example ? – Veak Sep 28 '23 at 19:17
  • But that's all explained in the docs with many understandable examples. And yes to your last question, in this case width is similar used as name. – lukeflo Sep 28 '23 at 19:18
  • Will have a look and report back. – Veak Sep 28 '23 at 19:19
  • 1
    @Veak yes, but the documentation has examples and there are thousands of key val examples on this site (and a few examples of \keys_define:nn { as well) if you don't have an actual question and just look for examples, a simple search would answer this. – David Carlisle Sep 28 '23 at 19:22
  • 1
    for example this answer of mine https://tex.stackexchange.com/a/669182/1090 (we could close this as duplicate?) – David Carlisle Sep 28 '23 at 19:23
  • What would \feuds_teorema_name_tl be ? When a user passes the value, would the value exist in \feuds_teorema_name_tl. Looks as if the name value would be assigned to \feuds_teorema_name_tl. – Veak Sep 28 '23 at 19:27
  • As mentioned in a comment on your previous question, your module name is not valid. (https://chat.stackexchange.com/transcript/message/64492157#64492157) – cfr Sep 28 '23 at 20:05
  • @Veak _tl is a token list i.e. a variable which can hold a list of zero or more tokens. – cfr Sep 28 '23 at 20:11
  • just copying a random fragment of code and asking what it does out of context is a strange way of learning a language. but name .tl_set:N = \feuds_teorema_name_tl, means that name=wibble is syntactic sugar for a user command that does \def\feuds_teorema_name_tl{wibble} that's all it does, what happens then depends how you use \feuds_teorema_name_tl – David Carlisle Sep 28 '23 at 20:19
  • I think this question creates more problems than it cant solve. – Veak Sep 28 '23 at 21:02

0 Answers0