I read the answer for this question (inside a environment) but I would like to know if there is something more specific. LaTeX keeps the current environment in the macro
\@currenvir but how do the test with the plain TEX format or the ConTEXt format.
TikZ has a command
However, the comments in the definition of the command (
So there may be a better way.