I use \eq{}
and \eq*{}
instead of \begin
and \end
equation.
\def\eq{\@ifstar\@eq\@eeq}
\def\@eq#1{\begin{equation*}\begin{split}#1\end{split}\end{equation*}}
\def\@eeq#1{\begin{equation}\begin{split}#1\end{split}\end{equation}}
It works well, however, when I try to use
\eq{\left( .... \right)} % no error
\eq*{\left( .... \right)} % \left can only be used in math mode
The editor warns me that left can only be used in math mode.
How do I make the editor think that my input is 100% math?
...
\def\@eq#1{\begin{equation*}\begin{split}\ensuremath{#1}\end{split}\end{equation*}}
...
does yield same error, but,
\eq*{\ensuremath{\left(...\right)}}
This works without error.
*When I say error, Its not that It fails to compile, but has red x mark on the left.. both method compiles as expected..
*Other maths (\frac{}{}, x_s,...
) work without error…
Best Answer
Your editor knows that
(not necessarily with the initial and terminal marks on the same line) and other environments are math, so it won't signal math specific commands inside them.
Instead, it apparently seems to be wanting to help you in avoiding common errors, like using math specific commands out of context.
You don't say which editor you're using, but the answer is independent of the editor. You have two choices:
teach the editor that the argument of
\eq
or\eq*
is math;avoid using “abbreviations” such as
\eq
and\eq*
.The second strategy is preferable: you perhaps gain a few keystrokes at the expense of input clarity and flexibility. I have no doubt what input is clearer in the following code.