l3styleguide.pdf reads

With the exception of simple runs of parameter ({#1}, #1#2, etc.), everything should be divided up using spaces to make the code more readable.

However, interface3.pdf shows examples both, {#1} and { #1 }.

So, I am a bit puzzled. What the preferred way? Did it change over time?

  • 4
    since it makes no difference and the syntax has been in use by different people over a 30 year period some syle differences may have slipped in:-) May 16 at 20:31
  • 2
    The preferred way is the way you think the code is more readable. Not everyone thinks that spaces achieve that goal.
    – Alan Munn
    May 16 at 20:53

The style guide tries to codify 'common' practice by the team. As mentioned in comments, on balance {#1} felt more 'readable' than { #1 } in most cases, whereas { \some_funct:N \l_some_var } seemed preferable. It's not universally applied, but is the most common formatting choice so is what is recommended.

  • Thanks. interface3.pdf contains {#1} 21 times and { #1 } 15 times . This means the former is "most common", but only by a small margin.
    – mhchem
    May 17 at 5:36
  • @mhchem Remember there are the cases of {#2} and so on - see e.g. the definition for \use_i:nnn.
    – Joseph Wright
    May 17 at 7:01
  • Also, you have to remember that say { #1 : #2 } or { #2 #1 } doesn't 'count' (the style guide here is specifically about parameter values given with nothing else and in order).
    – Joseph Wright
    May 17 at 7:03
  • I did only count the verbatim occurrences of {#1} and { #1 } in the official documentation document interface3.pdf.
    – mhchem
    May 17 at 12:30

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.