Is there a way to make sure that a macro can only be used inside a specific environment, say description?
I am looking for something like the \ensuremath macro.
|
Is there a way to make sure that a macro can only be used inside a specific environment, say I am looking for something like the |
||||
|
You can modify the definition of the environment in order to set the command to either work or not. For the
With the following result:
|
|||||||||||
|
|
The
You can add other environments and also provide a different meaning in different environments:
|
|||||||
|
|
The current environment name is stored in |
|||
|
|
\ensuremathmacro switches to math mode to typeset its argument if necessary. If your macro is called outside adescription, do you want it to flag an error, or start adescription? – Ian Thompson Jan 31 '12 at 16:36