4

This is my code for creating the matrix in Latex

How to add the underbrace

\begin{equation}
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}
\end{equation}

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

Thank you.

4

Here is one method using tikz overlays and markers

\documentclass[a4paper]{memoir}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{equation}
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}
\end{equation}
\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. – Mitun_C Feb 10 '17 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) – daleif Feb 10 '17 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. – Mitun_C Feb 10 '17 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. – daleif Feb 10 '17 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. – Mitun_C Feb 14 '17 at 13:56

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.