Jairo A. del Rio schrieb am 14.07.2020 um 02:08:
Hi list!

In evenmore pp. 76-77, concerning LMTX extended macro parsing, the following examples of #0, #+ and #- are given

\def\TestA#1#2#3{{(#1)(#2)(#3)}}
\def\TestB#1#0#3{(#1)(#2)(#3)}
\def\TestC#1#+#3{(#1)(#2)(#3)}
\def\TestD#1#-#2{(#1)(#2)}

So

\TestA1{\red 2}3
\TestB1{\red 2}3
\TestC1{\red 2}3
\TestD1{\red 2}3

give

(1)(2)(3) % red from "2" onward
(1)()(3)
(1)(2)(3) % only "2" is colored
(1)(3)

What I guess is that #+ pass an argument, grouping braces included (the report says an argument is passed "as-is"). I see it as really useful. But, apart from the example above, are there any other differences between doing, say, \def\foo#1#2#3 and \def\foo#+#+#+{#1#2#3}? Thank you very much.

It's usefull when you use optional arguments because TeX removes the braces around the content of the argument.

\starttext

\def\testa[#1]{\detokenize{#1}}
\def\testb[#+]{\detokenize{#1}}

\testa[{braces}]

\testb[{braces}]

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to