Hi,

inspired by [a recent TeX.sx question][1] this allows delimited macros
with `#` in the parameter text by doubling the `#`.
It isn't needed that often but it is useful if you try to analyze the
parameter text of a TeX macro using TeX code. Also it is completely
backward-compatible (`##` always triggers an error without this) and
it is very easy to implement.

For example:

\def\test#1###2{(#1)[#2]}
\test hello#{world}

would result in (hello)[world]

Best regards,
Marcel Krüger

1: 
https://tex.stackexchange.com/questions/491296/can-i-have-a-delimited-macro-with-a-literal-in-the-parameter-text
---
 source/texk/web2c/luatexdir/tex/scanning.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source/texk/web2c/luatexdir/tex/scanning.c 
b/source/texk/web2c/luatexdir/tex/scanning.c
index 8f7e1d591..e8b9fca66 100644
--- a/source/texk/web2c/luatexdir/tex/scanning.c
+++ b/source/texk/web2c/luatexdir/tex/scanning.c
@@ -2095,7 +2095,8 @@ halfword scan_toks(boolean macro_def, boolean xpand)
                     store_new_token(end_match_token);
                     goto DONE;
                 }
-                if (t == nine_token) {
+                if (cur_cmd == mac_param_cmd) {
+                } else if (t == nine_token) {
                     print_err("You already have nine parameters");
                     help1("I'm going to ignore the # sign you just used.");
                     error();
-- 
2.21.0



_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to