0

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}
\end{bmatrix}
$$

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?

4

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

\documentclass{article}
\usepackage{amsmath}
\newcommand\bovermat[2]{%
    \makebox[0pt][l]{$\smash{\overbrace{\phantom{%
                    \begin{matrix}#2\end{matrix}}}^{\text{#1}}}$}#2}
\newcommand\partialphantom{\vphantom{\frac{\partial e_{P,M}}{\partial w_{1,1}}}}
\begin{document}
\begin{equation}
\begin{matrix}
    A_n
    =
    \begin{bmatrix}
    a_1&b_{1,2}&\bovermat{1}{0,\cdots,0} & b_{1,s_{1}+1} &
    \bovermat{2}{0,\cdots,0}\\
    \end{bmatrix}
    \end{matrix}
    \end{equation}
\end{document}

which gives:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.