I'm looking for a command (say \foo{}
) or pair of commands (say \foos
, \fooe
) that behave like:
equation
environment if there is no \\
nor &
multline
if there is a single \\
align
if there are both &
and \\
Also, automatically switches between the *
variants if there is no \label
command.
The commands should be compatible with usual packages (amsmath
etc), and should support the usual \tag
, \label
, \ref
commands. Just to be clear, using it should not slow down compilation by any perceptible amount.
Bonus gratitude if you also give me a command to switch the behavior of \[
\]
from the usual one to the above one, back-and-forth in a paper.
I am constantly switching between the three environments and it is really annoying. Thanks!
Note: I am telling LaTeX where to break the equation. All I want is LaTeX to be smart enough to use the appropriate environment!
Best Answer
No, there isn't such a "do-it-all" environment. Each one of
equation
,multline
,align
andgather
(you forgot about this one) solves a different problem caused by different sets of math mode material to display.Breaking math mode material requires judgment that a machine can't have.
There are packages such as nath and breqn that try to automatize this process, but my opinion is that there's no easy algorithm to do breaking properly, because it requires to look at the result.
However, here it is a working
doitall
environment:I can understand your desire of a do-it-all environment; but you're losing information.
If you want to use
\[
and\]
as delimiters, just sayin the preamble. Switching the meaning of
\[...\]
back and forth is completely useless, of course.Limitations
You can't use
aligned
orgathered
environments inside thedoitall
environment, as these have&
and\\
inside them. It's of course impossible to use also thesplit
environment.