blefloch / latex-unravel

Watching TeX digest tokens
24 stars 1 forks source link

Brace delimited parameter in action #60

Closed muzimuzhi closed 6 months ago

muzimuzhi commented 6 months ago
\documentclass{article}
\usepackage{unravel}

\def\mycmd#1#{}
\unravel{\mycmd arg{}}

\begin{document}
\end{document}

Note the trailing # in parameter text and ending } for replacement text are both missing.

||
|> \mycmd arg{}

[===== Step 1 =====] \mycmd = macro:#1{->{
||
|> {}

[===== Step 2 =====]
<| {
||
|> }

[===== Step 3 =====]
<| {}
||
|>

[===== End =====]
blefloch commented 6 months ago

Thanks for the many relevant issues you raised and sorry that they lingered for so long.

For this one, I don't see why you would expect macro:#1#{->{}. In fact, I simply use the output of \meaning\mycmd here, which is macro:#1{->{, which seems fine: it means that #1 is delimited by a left brace and the brace is left in the input stream. So I'm tempted to close it as not an issue, do you agree?

On the other hand, these types of macros are problematic for another reason as they break an optimization, see #61, thanks for pointing me to this case.

muzimuzhi commented 6 months ago

In fact, I simply use the output of \meaning\mycmd here, which is macro:#1{->{, which seems fine: it means that #1 is delimited by a left brace and the brace is left in the input stream.

You're right. I totally forgot the form of output of \meaning\mycmd here.