So I was looking at my preamble, with Overleaf yelling at me for not putting a closing bracket after the piece of code attached below, which is strange, since that group is indeed closed. To confirm, I removed several commands until I realised that the problem arose on line 6 with \cs:w.
Any thoughts?
\ExplSyntaxOn
\NewDocumentCommand{\newenvcommand}{ m m } % #1 = env name, #2 = command name
{
\cs_if_exist:cF { g_envc_#1_list_tl } { \tl_new:c { g_envc_#1_list_tl } }
\tl_gput_right:cn { g_envc_#1_list_tl } { #2 }
\exp_after:wN \newcommand \cs:w envc_#1_\cs_to_str:N #2 \cs_end:
}
\NewDocumentCommand{\checkenvcommands}{ }
{
\cs_if_exist:cT { g_envc_\use:c {@currenvir} _list_tl }
{
\tl_map_inline:cn { g_envc_\use:c {@currenvir} _list_tl }
{
\cs_set_eq:Nc ##1 { envc_\use:c {@currenvir} _\cs_to_str:N ##1 }
}
}
}
\ExplSyntaxOff
\cs:wdid the colour and warning disappear. Is it just Overlead, or a general TeX thing? And how do I get rid of the warning? – Matt Nov 22 '19 at 22:38{}after\cs_end::\cs:w envc_#1_\cs_to_str:N #2 \cs_end: % { }... – Phelype Oleinik Nov 22 '19 at 22:40{}after a\newcommand. The problem was solved adding a commented{}after\newcommand. – Phelype Oleinik Nov 22 '19 at 22:47\cs:win the first place? Use\exp_args:Nc \newcommand { envc_#1_\cs_to_str:N #2 }instead. – egreg Nov 22 '19 at 23:00