3

I am putting three matrices inside of a kbordermatrix, but the delimiters do not envolve the inner matrices completely. How can I do to stretch the kbordermatrix delimiters to envolve the inner matrices?

My MWE:

\documentclass[brazil]{article}



\usepackage{amsfonts,amssymb,array,mathtools}
\usepackage{kbordermatrix}



\begin{document}

\begin{eqnarray} 
    \mathbf{A} & = & 
    \setlength{\kbrowsep}{2pt}
    \setlength{\kbcolsep}{0pt}
    \renewcommand{\arraystretch}{1.5}
    \renewcommand{\kbldelim}{(}
    \renewcommand{\kbrdelim}{)}
    \kbordermatrix{
        \omit & & , & & , & \cr
        \omit & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            0,9960 & -0,0037    \\
            0,0111 &  0,9867        
            \end{bmatrix}
            \endgroup} & , & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            0,9961 & -0,0059    \\
            0,0715 &  1,0423
            \end{bmatrix}
            \endgroup} & , & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            1,0034 & 0,0009     \\
            0,0098 & 0,9696
            \end{bmatrix}
            \endgroup}
    } \nonumber
\end{eqnarray}


\end{document}

The execution results of aforementioned code:

enter image description here

P.S.: I would like to stretch the delimiters until the red arrows.

1
  • What's the purpose of those commas hanging from nowhere?
    – egreg
    Commented Apr 14, 2019 at 9:19

3 Answers 3

3

You don't really need kbordermatrix to obtain this layout. However, the matrix in the last column can't have an overbrace, so I added a \vphantom of a similar matrix.

I also propose a variant with inner medium-sized matrices, with the mmatrix environment from nccmath. Last, I had to load icomma to have a correct spacing of the decimal comma.

\documentclass[brazil]{article}
\usepackage{amssymb, array, mathtools}
\usepackage{icomma, nccmath} 
\newenvironment{bmmatrix}{\medsize\bmatrix}{\endbmatrix\endmedsize}

\begin{document}

\begin{align*}
\mathbf{A} & = \renewcommand{\arraystretch}{1.5}
 \begin{pmatrix}
            \,\smash[t]{\overbrace{\begin{bmatrix}
            0{,}9960 & -0,0037 \\
            0,0111 & 0,9867
            \end{bmatrix}}}
 &\negthickspace{,}\negthickspace\! & 
            \smash[t]{\overbrace{\begin{bmatrix}
            0,9961 & -0,0059 \\
            0,0715 & 1,0423
            \end{bmatrix}}}
 &\negthickspace{,}\negthickspace\! & 
            {\smash[t]{\overbrace%
            {\begin{bmatrix}
            1,0034 & 0,0009 \\
            0,0098 & 0,9696
            \end{bmatrix}}}}\, \vphantom{\begin{bmatrix}\, \\ \,
  \end{bmatrix}}
 \end{pmatrix}\\[2ex]\ 
\mathbf{A} & = \renewcommand{\arraystretch}{1.5}
\begin{pmatrix}
            \,\smash[t]{\overbrace{\begin{bmmatrix}
            0{,}9960 & -0,0037 \\
            0,0111 & 0,9867
            \end{bmmatrix}}}
 &\negthickspace{,}\negthickspace\! &
            \smash[t]{\overbrace{\begin{bmmatrix}
            0,9961 & -0,0059 \\
            0,0715 & 1,0423
            \end{bmmatrix}}}
 &\negthickspace{,}\negthickspace\! &
            {\smash[t]{\overbrace%
            {\begin{bmmatrix}
            1,0034 & 0,0009 \\
            0,0098 & 0,9696
            \end{bmmatrix}}}}\, \vphantom{\begin{bmmatrix}\, \\ \,
  \end{bmmatrix}}
 \end{pmatrix}
 \end{align*}

\end{document}

enter image description here

4
  • I really wanted to work with kbordermatrix, but your solution is interesting. I did not understand why you used the negthickspace and the smash commands.
    – Adriano
    Commented Apr 14, 2019 at 3:24
  • The negthickspace is just for æsthetic reasons – so it's only a matter of personal taste. As to \smash[t], it is to ensure the three braces are above the external parentheses.
    – Bernard
    Commented Apr 14, 2019 at 8:54
  • You should compensate the \smash with a \vphantom, or the braces would not be taken into consideration for vertical spacing.
    – egreg
    Commented Apr 14, 2019 at 9:20
  • @egreg: That's right, but I have no context. If it's a new line in a multiline equation, a simple \\[2ex], for instance, might do the trick.
    – Bernard
    Commented Apr 14, 2019 at 9:24
3

Turn off \arraystretch. Then, manually, add the desired space between rows.

\documentclass[brazil]{article}

\usepackage{amsfonts,amssymb,array,mathtools}
\usepackage{kbordermatrix}

\begin{document}
\begin{eqnarray} 
    \mathbf{A} & = & 
    \setlength{\kbrowsep}{2pt}
    \setlength{\kbcolsep}{0pt}
%    \renewcommand{\arraystretch}{1.5}
    \renewcommand{\kbldelim}{(}
    \renewcommand{\kbrdelim}{)}
    \kbordermatrix{
        \omit & & , & & , & \cr
        \omit & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            0,9960 & -0,0037    \\[2ex]
            0,0111 &  0,9867        
            \end{bmatrix}
            \endgroup} & , & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            0,9961 & -0,0059    \\[2ex]
            0,0715 &  1,0423
            \end{bmatrix}
            \endgroup} & , & \overbrace{\begingroup
            \setlength{\arraycolsep}{2.5pt}
            \begin{bmatrix}
            1,0034 & 0,0009     \\[2ex]
            0,0098 & 0,9696
            \end{bmatrix}
            \endgroup}
    } \nonumber
\end{eqnarray}

\end{document}

enter image description here

1
  • @StevenSegletes, I tested your solution and it worked fine. Thank you by help.
    – Adriano
    Commented Apr 14, 2019 at 0:33
1

My opinion is that kbordermatrix is the wrong tool for the job.

I suggest using siunitx for numeric tables.

Here the trick is to use a phantom two-line array in order to set the left and right delimiters. The definitions are made inside \[...\], so they are local to it.

If you have an alignment, the local definitions should be arranged differently, but it depends on what you're trying to achieve.

In any case, never use eqnarray (see eqnarray vs align).

\documentclass{article}
\usepackage{amsfonts,amssymb,array,mathtools}
\usepackage{siunitx}

\usepackage{lipsum} % for context

\sisetup{output-decimal-marker={,}}

\newcolumntype{T}[1]{S[table-format=#1]}
\newenvironment{nmatrix}[1]
 {\begin{bmatrix}\begin{tabular}{@{}#1@{}}}
 {\end{tabular}\end{bmatrix}}

\begin{document}

\lipsum*[3]
\[
\renewcommand{\tabcolsep}{2.5pt}
\renewcommand{\arraystretch}{1.2}
\newcommand{\LEFT}{%
  \left(\vphantom{\begin{bmatrix}1\\1\end{bmatrix}}\right.
}
\newcommand{\RIGHT}{%
  \left.\vphantom{\begin{bmatrix}1\\1\end{bmatrix}}\right)
}
%% Now the real job
\mathbf{A}=
\LEFT
\overbrace{
  \begin{nmatrix}{T{1.4}T{-1.4}}
  0,9960 & -0,0037    \\
  0,0111 &  0,9867        
  \end{nmatrix}
}\;,\;
\overbrace{
  \begin{nmatrix}{T{1.4}T{-1.4}}
  0,9961 & -0,0059    \\
  0,0715 &  1,0423
  \end{nmatrix}
}\;,\;
\overbrace{
  \begin{nmatrix}{T{1.4}T{1.4}}
  1,0034 & 0,0009     \\
  0,0098 & 0,9696
  \end{nmatrix}
}
\RIGHT
\]
\lipsum[3]

\end{document}

enter image description here

1
  • I really would like to use the kbordermatrix, because this package has the left and upper sides options to use as explainations of lines and columns. I know bordermatrix, but I read in kborderdermatrix documentation that kbordermatrix is an improvement version to bordermatrix. Is there any alternative as simmilar as kbordermatrix?
    – Adriano
    Commented Apr 15, 2019 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .