Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runaway arg recovery for non-\long macro receiving \par #7

Open
blefloch opened this issue Sep 21, 2015 · 2 comments
Open

Runaway arg recovery for non-\long macro receiving \par #7

blefloch opened this issue Sep 21, 2015 · 2 comments

Comments

@blefloch
Copy link
Owner

The error recovery for non-\long macros which have simple arguments (#1#2#3...) when they receive \par is different in unravel than in TeX.

\RequirePackage{unravel}
\def\test#1{}
\unravel{\test\par}

internally finds the argument \par, braces it, then expands \test{\par}. TeX complains that there is a runaway argument, and drops everything until the \par. That leaves a brace that has no reason to be there.

@blefloch
Copy link
Owner Author

Setting the (internal) "speedup macros" boolean to false fixes the problem. One issue is that \@@_macro_call_quick_loop:NNN calls \@@_input_gpop_item:NF and loses track of whether the argument was braced or not. Otherwise we could look for the string \par in the argument and fall back to \@@_macro_call_safe: in such cases.

@blefloch
Copy link
Owner Author

blefloch commented Jan 4, 2024

Actually the problem is more dire than I had understood. With \def\test#1{}, expanding \test{{{{{\par}}}}} leads to a Runaway error and leaves five closing braces in the input stream. The only way I see to deal with this on the unravel side would be to have a method that splits a gtl variable at the first \par. (See feature request blefloch/latex-gtl#4.) Then throw away the part before \par, complaining about a Runaway argument, and keep everything after, which most likely leads to other TeX errors detected by unravel.

blefloch added a commit that referenced this issue Jan 5, 2024
This only really helps in the case where \par is an unbraced argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant