0

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? – Bernard 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.. – kando Jul 16 '17 at 19:21
  • please make your examples documents so that people can see the intended output. – David Carlisle 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. – kando 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 – David Carlisle Jul 16 '17 at 22:10
1

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.

enter image description here

\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.

enter image description here

\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}
| improve this answer | |
  • I think you misunderstood - I'm looking for independent equations to be aligned with each other, as if in an array. – kando Jul 16 '17 at 22:19
  • 1
    @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 – David Carlisle Jul 16 '17 at 22:19
  • hmm, hold on - I'll make a better example. – kando Jul 16 '17 at 22:20
  • 1
    @kando answer updated, but I would use gather not aligned here. – David Carlisle Jul 16 '17 at 22:53
  • 1
    @kando several answers with code for that, eg tex.stackexchange.com/questions/102816/… – David Carlisle Jul 16 '17 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.