From this upper brace, I try to put a brace over the first 9 columns the 9 parameters below. I would like to align them with the 9 first columns of matrix, each one of this parameter aligned with each corresponding columns of matrix:
$\Omega_{b,0} h \Omega_{m,0} n_{s} \Omega_{\text{DE}} w_{0} w_{a} \sigma_{8} \gamma:$
Here what I have done:
% Matrix with brace
\newcommand\overmat[2]{%
\makebox[0pt][l]{$\smash{\color{white}\overbrace{\phantom{%
\begin{matrix}#2\end{matrix}}}^{\text{\color{black}#1}}}$}#2}
\newcommand\bovermat[2]{%
\makebox[0pt][l]{$\smash{\overbrace{\phantom{%
\begin{matrix}#2\end{matrix}}}^{\text{#1}}}$}#2}
\begin{bmatrix}
\overmat{$\Omega_{b,0} h \Omega_{m,0} n_{s} \Omega_{\text{DE}} w_{0} w_{a} \sigma_{8} \gamma$}{ h^2 & 2&h\Omega_{b,0} &0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 2h\Omega_\text{m,0} & h^2 & 0 & 0 & 0 & 0 & 0& 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 1 & 0 & 0 & 0 & 0& 0 & 0& 0 & 0 & 0 & 0 & 0 & 0 \\
\end{bmatrix}
and the result is:
As you can see, the parameters are not aligned with each of columns, everything is concentrated on the 3 first columns and I don't understand the reason.
How to perform a right alignment and with a brace stretched on all the 9 first columns.
UPDATE 1:
Here is the suggestion of F. Pantigny:
\documentclass{article}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
$\begin{bNiceArrayRC}{*9C}%
[code-after= {\begin{tikzpicture}
\draw [decorate,decoration = brace]
([yshift=1.5mm]1-1.north west) to
([yshift=1.5mm]1-8.north east) ;
\end{tikzpicture}
}]
a & b & \Omega_{m,0} & d & e & f & g & h \\[1.5mm]
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 2h\Omega_{m,0} & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{bNiceArrayRC}$
\end{document}
It is almost that I wanted to get. The only point is that I would like to shift "the brace and the parameters" slightly to the top.
Naively, I tried to increase yshift=1.5mmand [1.5mm]to 4mm :
\documentclass{article}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{xspace}
\begin{document}
$\begin{bNiceArrayRC}{*9C}%
[code-after= {\begin{tikzpicture}
\draw [decorate,decoration = brace]
([yshift=4mm]1-1.north west) to
([yshift=4mm]1-8.north east) ;
\end{tikzpicture}
}]
a & b & \Omega_{m,0} & d & e & f & g & h \\[4mm]
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 2h\Omega_{m,0} & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{bNiceArrayRC}$
\end{document}
But the result is bad :
Indeed, this is not the brace and parameters which are shifted to the top but this is the content of matrix.
How to shift instead the brace and parameters to the top ?
Regards




[4mm]of the first\\and put\rule[-6mm]{0mm}{0mm}(that is a strut) in the first cell. – F. Pantigny Jan 27 '19 at 20:24