I recently started learning LaTeX and though I found answers for almost all of my questions by looking online (and especially here), there is still one more thing I would like to be able to do but can't for the article I am writing:
I would like to be able to specify the dimensions and the "subdimensions" below a matrix. To be clearer, let us take the following example:
$ D = \underbracket{\begin{pmatrix} D_1 & 0 & 0 & & & \\ 0 & \ddots & & & {\textrm{\huge 0}} & \\ 0 & 0 & D_n & & & \\ & & & & & \\ & \textrm{\huge 0} & & & {\textrm{\huge 0}} & \\ & & & & & \\ \end{pmatrix}}_N $ this gives a nice matrix whith the dimension N specified as a bracket under the matrix. That is fine, however I would like to add a second bracket to specify the smaller dimension n of the inner block matrix right below the matrix (and possibly above the first main bracket) which is shorter, i.e. I would like it to extend from 1 to n and not all the way below the matrix.
I am open to any solution, but the simpler the better for me :)




\documentclass{}and ending with\end{document}, making sure you include any packages that are required to compile the above code?