# Underbrace Math Mode

This is my code for creating the matrix in Latex

$$G = \begin{bmatrix} g_0 \\ g_1 \\ . \\ . \\ . \\ g_k-1\\ \end{bmatrix} = \setcounter{MaxMatrixCols}{15} \begin{bmatrix} p_{0,0} & p_{1,0} & . & . & . & p_{0,n-k-1} & & & & 1 & 0 & . & . & . & 0 \\ p_{0,1} & p_{1,1} & . & . & . & p_{1,n-k-1} & & & & 0 & 1 & . & . & . & 0 \\ . & . & . & & & . & & & & . & . & . & & & . \\ . & . & & . & & . & & & & . & . & & . & & . \\ . & . & & & . & . & & & & . & . & & & . & . \\ p_{0,n-k-1} & p_{1,n-k-1} & . & . & . & p_{k-1,n-k-1} & & & & 0 & 0 & . & . & . & 1 \\ \end{bmatrix}$$


How to add the underbrace for the highlighted part of the submatrix P ?

Thank you.

Here is one method using tikz overlays and markers

\documentclass[a4paper]{memoir}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
$$G = \begin{bmatrix} g_0 \\ g_1 \\ . \\ . \\ . \\ g_k-1\\ \end{bmatrix} = \setcounter{MaxMatrixCols}{15} \begin{bmatrix} p_{0,0} & p_{1,0} & . & . & . & p_{0,n-k-1} & & & & 1 & 0 & . & . & . & 0 \\ p_{0,1} & p_{1,1} & . & . & . & p_{1,n-k-1} & & & & 0 & 1 & . & . & . & 0 \\ . & . & . & & & . & & & & . & . & . & & & . \\ . & . & & . & & . & & & & . & . & & . & & . \\ . & . & & & . & . & & & & . & . & & & . & . \\ \tikzmark{A} p_{0,n-k-1} & p_{1,n-k-1} & . & . & . & p_{k-1,n-k-1}\tikzmark{B} & & & & 0 & 0 & . & . & . & 1 \\ \end{bmatrix}$$
\begin{tikzpicture}[remember picture,overlay,decoration={brace,amplitude=5pt,mirror,raise=5pt}]
\draw[red,decorate] (pic cs:A) -- (pic cs:B)
node [midway,below=9pt] {$p$};
\end{tikzpicture}

\end{document}

• Can you also tell me or give me the link to download the package tikz. Commented Feb 10, 2017 at 15:28
• @Mitun_C Which LaTeX installation do you use? Most installations has a package manager that can be used to install packages. Instead of using very small LaTeX installations, I recommend to install everything, for example installing the latest TeXLive (TeXLive from Linux is often fragmented and odd) Commented Feb 10, 2017 at 15:58
• Using Texmaker in Linux. I dont have administrative access in this computer. There are also Kile and KBibtex available. Is there any way to check where the packages are downloaded, so that I can update them. Commented Feb 10, 2017 at 16:23
• @Mitun_C Ask your administrator to provide a full latex installation. If usepackage tikz does not work, you have very basic installation which is not very useful. Commented Feb 10, 2017 at 17:11
• I tried your recommendations for installing tikz packages, but it is not so easy to get it done with my admin. Can you give me a solution without the tikz method ? Thank you. Commented Feb 14, 2017 at 13:56