I am quite a noob when it comes to customising LaTeX/XeLaTeX. I would like to know if there's a way to limit the usage of a macro to a specific environment.
Consider the following macro and environment:
\newcommand\myMacro[2]{#1 ... #2}
\newenvironment{myEnv}{...}{...}
I would like the following:
\begin{myEnv}
% The following two calls to \myMacro are valid.
\myMacro{...}{...} .... \myMacro{...}{...}
\end{myEnv}
% This one should not be valid and throw an error.
\myMacro{...}{...}
I know this might not be the best design. I just want to make sure that I can't use \myMacro outsite of myEnv.