# creating a matrix with rows and columns numbered on outside [closed]

$$\text{i: current-state}\Bigg\{\begin{matrix}0 \\ 1 \\ 2\end{matrix}\underbrace{\begin{bmatrix}P_{00} & P_{01} & P_{02} \\ P_{10} & P_{11} & P_{12} \\ P_{20} & P_{21} & P_{22}\end{bmatrix}}_{\text{j: next-state: 0, 1 ,2 }}$$


What's the best way to create a matrix with rows and columns numbered...

• The code throws errors (\Bigg{ should probably be \Biggl\{) and there is only one row in this matrix. Please try to explain the problem better. Jul 31, 2020 at 15:08
• Off-topic: in LaTeX don't use . Rather use $ ... $. Jul 31, 2020 at 15:23
• The best way is use of the tools with which you are familiar. For example see nicetabular (see tex.stackexchange.com/questions/512393/… or answer below) or blkarray (see example tex.stackexchange.com/questions/335444/…). Aug 13, 2020 at 6:42

Here is a suggestion.

\documentclass{article}
\usepackage{array,amsmath}
\begin{document}

$\begin{array}{c@{}c} \text{text} \left\{\begin{array}{c@{}} 0 \\ 1 \\ 2 \\ \end{array}\right. & \left[\begin{array}{@{}*{3}{wc{5mm}}@{}}$P_{00}$&$P_{01}$&$P_{02}$\\$P_{10}$&$P_{11}$&$P_{12}$\\$P_{20}$&$P_{21}$&$P_{22}$\\ \end{array}\right]\\ & \underbrace{\begin{array}{@{}*{3}{wc{5mm}}@{}} 0 & 1 & 2 \end{array}}_{\text{text}} \end{array}$

\end{document}


• Remark: In the future version of LaTeX (oct. 2020), the wc columns of array will be in math mode whereas they are in text mode as of now. Jul 31, 2020 at 20:02