I've defined a couple simple macros to make my life a little easier:
\newcommand{\curl}[1]{\ensuremath{\nabla\times #1}}
\renewcommand{\v}[1]{{\ensuremath{\vec{#1}}}}
This way, in text mode I can write \v{F}
or \curl{\v{F}}
, and all is well.
But for simplicity, at least in math mode, I'd like to be able to just write \curl\v{F}
, and have it expand to
\ensuremath{\nabla\times {\ensuremath\vec{F}}}
just like \curl{\v{F}}
. Since I've defined \curl
in a pretty simple manner, this currently looks right. However, I think I'm actually getting a stranger behavior: if I change the definition of \curl
to have parentheses, like {(\ensuremath{\nabla\times #1})}
, then the vector symbol shows up over the closing parenthesis, as if the \v
(but not its argument) is being captured as an argument to \curl
.
Strangely, though, simply typing \ensuremath{(\nabla\times {\ensuremath\vec})}
results in errors.
What's going on here? Is there a good way to do this, and is it a good idea?
(By the way, the reason I have an extra pair of {}
in the definition of \v
is that it allows me to use \int_\v{x}
rather than \int_{\v{x}}
. This much seems to work, but I'm not really sure why.)