I am trying to achieve a table similar to the picture below. I have almost made it, but I can't figure out how to put the row with "a_{1n} ..." below the matrix so that it matches to rows.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,matrix}
\tikzset{
table/.style={
matrix of math nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={rectangle,text width=3em,align=center},
text depth=1.25ex,
text height=2.5ex,
nodes in empty cells,
left delimiter=[,
right delimiter={]},
ampersand replacement=&
}
}
\begin{document}
[
A=
\begin{tikzpicture}[baseline,decoration=brace]
\matrix (m) [table] {
1 & 0 & \cdots & 0 & \lvert & 1 & 1 & \cdots & 1 \
0 & 1 & \cdots & 0 & \lvert & 0 & 0 & \cdots & 0 \
\vdots & \vdots & \ddots & 0 & \lvert & \vdots & \vdots &\ddots& \vdots \
0 & 0 & \cdots & 1 & \lvert & 0 & 0 & \cdots & 0 \
\textrm{--} & \textrm{--} & \textrm{--} & \textrm{--} & \textrm{--}& \textrm{--} & \textrm{--} & \textrm{--} & \textrm{--} \
0 & 0 & \cdots & 0 & \lvert & 1 & 0 & \cdots & 1 \
0 & 0 & \cdots & 0 & \lvert & 0 & 1 & \cdots & 0 \
\vdots & \vdots & \ddots & 0 & \lvert & \vdots & \vdots &\ddots& \vdots \
1 & 1 & \cdots & 1 & \lvert & 0 & 0 & \cdots & 1 \
};
\draw[decorate,transform canvas={xshift=-1.4em},thick] (m-4-1.south west) -- node[left=2pt] {$m$} (m-1-1.north west);
\draw[decorate,transform canvas={xshift=-1.4em},thick] (m-9-1.south west) -- node[left=2pt] {$n$} (m-6-1.north west);
\draw[decorate,transform canvas={yshift=0.5em},thick] (m-1-1.north west) -- node[above=2pt] {$m$} (m-1-4.north east);
\draw[decorate,transform canvas={yshift=0.5em},thick] (m-1-6.north west) -- node[above=2pt] {$n-1$} (m-1-9.north east);
\end{tikzpicture}
]
\end{document}



nicematrix, I suggest to use the\CodeAfterinstead of thecode-beforebecause thecode-beforerequires one more compilation. – F. Pantigny Feb 14 '21 at 18:39