Handle hash symbols properly in \eappto#38
Handle hash symbols properly in \eappto#38wise0704 wants to merge 3 commits intojosephwright:mainfrom
Conversation
|
I'm afraid we can't use I'm also not really sure that hash symbols are intended to be supported anyway - |
Well, that's very unfortunate, as So after hours of googling, I just came across this SE answer which sadly and ironically comes up with The second answer in that same post suggests an alternative "for less recent TeX engines where [...] \newrobustcmd{\eappto}[2]{%
\ifundef{#1}
{\edef#1{\scantokens{#2\noexpand}}}
{\edef#1{\expandonce#1\scantokens{#2\noexpand}}}}Now, Ulrich Diez mentions in that answer the side effect of |
Sorry, I missed this part. While most of the usage would be for simple tokens, still the current implementation does support hash symbols for |
|
Well on a second look, the above method doesn't work when From the documentations, The \edef#1{\expandonce#1\expandonce{\romannumeral\__exp_e:nn{#2}{}}}is exactly the behaviour we want, but I'm not sure about your opinion on using expl3 (or reimplementing |
Currently,
\eappto(and\epreto,\xappto, etc.) requires hash symbols#to be doubled, which is definitely an unintended behaviour since the command to expand cannot have arguments in the first place.Consider the following examples.
Handling of hash symbols in
\apptoworks as it should:However, to achieve the same thing with
\eappto, you need to double the hash symbols:That would only make sense if
#1had a meaning within the second argument of\eappto.Obviously, it cannot have any meaning, since
testDcannot have any arguments to be used with\eapptoin the first place.