Open muzimuzhi opened 6 months ago
Thanks for the new idea. Currently, I have no time, but I will look into it end of next week,
I will add stricter checks to \__tcobox_set_backslash_removed:Nn
, but the box creation commands will stay as they are for a while. Nevertheless, I keep the idea of overworking the box creation commands in mind.
According to change entries of v5.1.0,
But I find
\newtcbox{mybox}{...}
works like\newtcbox{\ybox}{...}
quietly. https://github.com/T-F-S/tcolorbox/blob/067f384e2ba85ba3fd91958eb6adb8a1bcea6c29/tex/latex/tcolorbox/tcolorbox.sty#L2315-L2320More corner cases:
Here I suggest to enforce stricter checks on box names, so that a valid box name must be a single control sequence after space trimming.
To further totally ignore the whole box (re)definition if invalid box name is detected, it seems a bigger refactor is needed.
Below is one such attempt for
\newtcbox
which can be extended to other box creation commands. It avoids assignment to\l__tcobox_tmpa_tl
and limit use of\NewDocumentCommand
to user commands only (no internals like\__tcobox_new_tcbox_i:w
), but results in longer definition of\newtcbox
.I'd like to find a more generic way, perhaps one (higher-order) function for the
\(re)newcommand
routine, and another one for\NewDocumentCommand
-like routine.Came into this idea when viewing
\tl_set:Nx
to\tl_set:Ne
change in\__tcobox_set_backslash_removed:Nn
in 067f384 (6.2.0, 2024-01-10).