# How to use braces at left and top of array in equation mode?

I tried to put 2 braces, one at the top and one at the left, but I got an ugly effect. How to fit both braces with the array?

\documentclass[12pt]{report}
\begin{document}
\begin{equation}
lines \overbrace{\left\{\begin{array}{|r|r|r|r|r|}
\hline
4 & 6 & 5 & 7  & 9  \\
\hline
3 & 5 & 7 & 8  & 10 \\
\hline
1 & 3 & 9 & 10 & 12 \\
\hline
2 & 4 & 3 & 9  & 11 \\
\hline
\end{array}\right.}^{columns}
\end{equation}
\end{document} • Instead \documentclass$12pt${report} is correct \documentclass[12pt]{report}. Correcting this I obtain nice braces, only over on also consider left one ... Aug 12, 2016 at 19:59
• Thank you for the correction @Zarko. Did you get nice braces with this code? the top brace takes the left brace. How to solve this problem? Aug 12, 2016 at 20:04
• this looks like what you want: How can I have a brace on the left and the top of a matrix without overlapping? Aug 12, 2016 at 20:05

An rude solution, similar to solution which Barbara Beeton pointed in her comment: \documentclass[12pt]{report}
\begin{document}
\begin{equation}
lines \left\{\vphantom{\begin{array}{c}
\hline
4 \\
\hline
3 \\
\hline
1 \\
\hline
2 \\
\hline
\end{array}}\right.%
\overbrace{\begin{array}{|r|r|r|r|r|}
\hline
4 & 6 & 5 & 7  & 9  \\
\hline
3 & 5 & 7 & 8  & 10 \\
\hline
1 & 3 & 9 & 10 & 12 \\
\hline
2 & 4 & 3 & 9  & 11 \\
\hline
\end{array}}^{columns}
\end{equation}
\end{document}

• As you pointed, similar. But in fact, better, because make use of all first column with \vphantom. Aug 12, 2016 at 20:23

Here is another solution, based on blkarray:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}%
\usepackage{blkarray, amsmath}

\begin{document}

\begin{equation}
\renewcommand\arraystretch{1.6}
\overbrace{\mkern-8mu\begin{blockarray}{rrrrr}%
\hphantom{10}& \hphantom{10} &\hphantom{10} & & \\[-4ex]
\begin{block}{\Left{\footnotesize lines\,}{\{\hspace{0.8em}}|r|r|r|r|r|}
\BAhline
4 & 6 & 5 & 7 & 9 \\
\BAhline
3 & 5 & 7 & 8 & 10 \\
\BAhline
1 & 3 & 9 & 10 & 12 \\
\BAhline
2 & 4 & 3 & 9 & 11 \\
\BAhline
\end{block}
\end{blockarray}\mkern-8mu}^\text{columns}%
\end{equation}

\end{document} 