# Robust equation numbering

Is there a robust equation-numbering environment
in which I can:

• Have as many columns as I would like (default centered, like a matrix).
• Mark start and end of line(s) I would like numbered.
• Center the numbering across multiple lines which were group numbered.
• Use multicolumn / multirow wherever.

Actual MWE:

\documentclass{scrreprt}
\usepackage{amsmath}

\begin{document}

\begin{gather}
\begin{array}{ccccccccccccc}
K_{\ddot{\phi}}
& \cdot
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
& + &
K_{\dot{\phi}}
& \cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
& + &
K_{\phi}
& \cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
& = &
K_{v}
& \cdot
\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
%%
\\[+2em]
%%
I
& \cdot
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
& = &
-K_{\ddot{\phi}}^{-1}
\cdot
K_{\dot{\phi}}
& \cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
& + &
-K_{\ddot{\phi}}^{-1}
\cdot
K_{\phi}
& \cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
& + &
K_{\ddot{\phi}}^{-1}
\cdot
K_{v}
& \cdot
\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
\end{array}
%%
\end{gather}

\end{document}


This MWE does not encapsulate all requested features,
but, for example, I would have liked to have centered all depicted vectors.

Desired Example:

\begin{Equation}
%%
\begin{numbered}
\label{EQN:A}
y & = & m \cdot x
\end{numbered}
%%
\\
%%
y & = & m & \cdot & x
%%
\\
\begin{numbered}
\label{EQN:B}
%%
y & = & M & \cdot & x
%%
\\
%%
Y & = & M & \cdot & X
%%
\end{numbered}
%%
\end{Equation}


(Sorry for the lack of originality in the example.)

Effectively, the Equation environment would allow
the entire list of equations to act as a matrix* or tabular,
and the nested enviroment numbered would encapsulate numbering,
without disrupting the indexing of the matrix.

• But the Equation environment remains to be defined? Jul 16 '17 at 18:57
• @Bernard Can you elaborate that? If it's what I think you mean: I used Equation with a capitol E because I assumed that it doesn't exist yet. Just a generic name.. Jul 16 '17 at 19:21
• please make your examples documents so that people can see the intended output. Jul 16 '17 at 21:24
• @DavidCarlisle Alright, the 'actual' example should now be an MWE. The 'desired' example shouldn't compile because it, to my knowledge, does not exist. Jul 16 '17 at 21:57
• it's really not clear what you want to change, the mwe has two equations and three equation numbers (the third row being blank) but it isn't really clear why you have the nested array environment which is just forcing everything not to be in displaystyle and bad spacing around the + ? I can't guess what parts of the output you want to change Jul 16 '17 at 22:10

array is designed for matrices (like the AMS bmatrix that you are using) it is unsuitable for setting displayed equations as it puts the cells in textstyle and the spacing is incorrect. Also if the array only have one row then the ccc doesn't really centre anything, lll would have the same effect, as the cell is just as wide as its content.

example from the updated question

For the updated example you could use alignat rather than gather but the alignment here, aligning = with + seems very strange and designed to imply a symmetry that is not in the underlying mathematics. \documentclass{scrreprt}
\usepackage{amsmath}

\begin{document}

\begin{alignat}{7}
K_{\ddot{\phi}}
\cdot
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
&+
K_{\dot{\phi}}
&\cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
& +
K_{\phi}
&\cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
& =
K_{v}
\cdot
&\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
%%
\\[+2em]
%%
I
\cdot
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
&1=
-K_{\ddot{\phi}}^{-1}
\cdot
K_{\dot{\phi}}
&\cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
& +
-K_{\ddot{\phi}}^{-1}
&\cdot
K_{\phi}
\cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
& +
K_{\ddot{\phi}}^{-1}
\cdot
K_{v}
&\cdot
\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
%%
\end{alignat}

\end{document}


original example

For a setting such as the example I would use gather that does centre the expressions and set them in display math mode. \documentclass{scrreprt}
\usepackage{amsmath}

\begin{document}

\begin{gather}
K_{\ddot{\phi}}
\cdot
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
+
K_{\dot{\phi}}
\cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
+
K_{\phi}
\cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
=
K_{v}
\cdot
\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
\\[+1em]
%%
\begin{bmatrix}
\ddot{\phi}_{x}\\
\ddot{\phi}_{y}\\
\end{bmatrix}
=
-K_{\ddot{\phi}}^{-1}
\cdot
K_{\dot{\phi}}
\cdot
\begin{bmatrix}
\dot{\phi}_{x}\\
\dot{\phi}_{y}\\
\end{bmatrix}
+
-K_{\ddot{\phi}}^{-1}
\cdot
K_{\phi}
\cdot
\begin{bmatrix}
\phi_{x}\\
\phi_{y}\\
\end{bmatrix}
+
K_{\ddot{\phi}}^{-1}
\cdot
K_{v}
\cdot
\begin{bmatrix}
v_{mtr.l}\\
v_{mtr.r}\\
\end{bmatrix}
\end{gather}

\end{document}

• I think you misunderstood - I'm looking for independent equations to be aligned with each other, as if in an array. Jul 16 '17 at 22:19
• @kando there is no alignment in the example you posted, and no alignment really possible as the terms either side of the = are so diferent Jul 16 '17 at 22:19
• hmm, hold on - I'll make a better example. Jul 16 '17 at 22:20
• @kando answer updated, but I would use gather not aligned here. Jul 16 '17 at 22:53
• @kando several answers with code for that, eg tex.stackexchange.com/questions/102816/… Jul 16 '17 at 23:02