I need to create a matrix and some overbraces on some entries at the top of the matrix like the following image(the entries are omitted)

enter image description here

I tried this code

A_n = \begin{bmatrix}
a_1&b_{1,2}&\overbrace{0, \cdots, 0}^{N_1-1}&b_{1,S_1+1}&\overbrace{0, \cdots, 0}^{N_2-1}

and this was the result. I don't want the overbrace to be inside the matrix

enter image description here

How can I do that?


1 Answer 1


May be this will help you (adapted from this answer):

\newcommand\partialphantom{\vphantom{\frac{\partial e_{P,M}}{\partial w_{1,1}}}}
    a_1&b_{1,2}&\bovermat{1}{0,\cdots,0} & b_{1,s_{1}+1} &

which gives:

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .