You can define a command as
\newcommand\set[1]{%%
\begingroup
\def\suchthat{... some definition...}%%
... other macro content ....
\endgroup}
And this will make \suchthat
available inside the macro.
You could have done this with \bgroup
and \egroup
, but that creates a subformula with consequences on how the spacing is handling if used in math mode.
The \begingroup
and \endgroup
here localize the definition of new macros. You can use any of the following to define a local command, \def
, \edef
, and \newcommand
.
Following the suggestion of @barbarabeeto you could do something like this in your preamble:
\makeatletter
\def\ae@suchthat{... definition of such that ...}
\newcommand\aset[1]{%%
\let\suchthat\ae@suchthat
the body of the macro: #1
\let\suchthat\undefined
}
\makeatother
This is much better. In addition to the reasons that barbarabeeto suggests, this would also allow your macro---should you so wish---to define or set values that you may want to access later in the document. With the \begingroup/\endgroup
approach, those would have to be globalized, which might not be what you'd want.
A hybrid approach could look like
\makeatletter
\def\ae@suchthat{... definition of such that ...}
\newcommand\aset[1]{%%
\begingroup
\let\suchthat\ae@suchthat
the body of the macro: #1
\endgroup
}
\makeatother