[Tex/LaTex] Alignment in matrix (bmatrix)

alignmatrices

Here is a MWE:

\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}

\begin{document}

The reparameterisation is
\begin{equation}
\label{eqn:linear_ssK3}
    \begin{matrix}
    s
    & = & [ &
    s_1 & s_2 & s_3 & s_4 & s_5
    & ]^T \\
    & = & [ &
        \phi_1+ABCD   &
        \phi_2+ABCD   &
        \tau_{p3}+ABCD&
        \mu_p+ABCD    &
        \mu_p^2+ABCD  &
    ]^T
    \end{matrix}.
\end{equation}

\end{document}

I am trying to use this type of alignment. But notice that the full stop sign . is at the wrong place.

Is there a better way to achieve this?

Thanks!!

Updated:

Sorry if I was not clear and may have caused some confusion.
I would hope to align the elements in the cells like the updated matrix.
A lot of the suggested approach would not align in such way.

Probably exaggerated, but hope to make my point of what I want to achieve.

Best Answer

If you want to keep the alignment between the columns, use an array, with some enhancement:

\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}
\usepackage{array}

\begin{document}

The reparameterisation is
\begin{equation}
\label{eqn:linear_ssK3}
\begin{array}{@{} >{{}}r<{{}} @{}r@{\,} *{5}{c} @{\,}l@{}}
s = & [ & s_1       & s_2       & s_3          & s_4      & s_5     & ]^T \\[1ex]
  = & [ & \phi_1^{} & \phi_2^{} & \tau_{p3}^{} & \mu_p^{} & \mu_p^2 & ]^T.
\end{array}
\end{equation}

\end{document}

enter image description here

For a one off application that's good; if several similar displays are needed, you can define an environment and a command to ease the input:

\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}
\usepackage{array}

\newenvironment{alignedrows}[1]
 {\begin{array}{@{} >{{}}r<{{}} @{}r@{\,} *{#1}{c} @{\,}l@{}}}
 {\end{array}}
\newcommand{\arow}[2]{%
  #1 & [ & #2 & ]^T %
}

\begin{document}

The reparameterisation is
\begin{equation}
\label{eqn:linear_ssK3}
\begin{alignedrows}{5}
\arow{s=}{ s_1       & s_2       & s_3          & s_4      & s_5     } \\[1ex]
\arow{ =}{ \phi_1^{} & \phi_2^{} & \tau_{p3}^{} & \mu_p^{} & \mu_p^2 }.
\end{alignedrows}
\end{equation}

\end{document}

The output is the same.