2

I would like to highlight block of matrix, which is formed by its first 3 lines and columns. In order to make it, I was thinking to put an overbrace on 3 first columns, like this figure:

Exemple of how I want my matrix

But I would also like to specify for which columns or rows I will expand overbrace of matrix outside. How can I do it using nicematrix package? Below, it follows the basic MWE to make the matrix that I want.

\documentclass{article}



\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{nicematrix}

\usetikzlibrary{matrix}



\begin{document}


\begin{small}           
%   \begin{subequations}
        \begingroup
        \allowdisplaybreaks
        \begin{gather}
            \begin{aligned} 
                \boldsymbol{\mathcal{F}}^{i} & = %
                \begingroup
                    \begin{bNiceMatrix}[%
                    margin,
                    nullify-dots,
                    ]
                        \mathtt{f}_{1\,1} & \Cdots & \mathtt{f}_{1\,\varpi} & \mathtt{f}_{1\,(\varpi+1)} & \Cdots & \mathtt{f}_{1\,\eta} %
                        \\
                        \Vdots & \Ddots & \Vdots & \Vdots & & \Vdots %  
                        \\
                        \mathtt{f}_{\varpi\,1} & \Cdots & \mathtt{f}_{\varpi\,\varpi} & \mathtt{f}_{\varpi\,(\varpi+1)} & \Cdots & \mathtt{f}_{\varpi\,\eta} %
                        \\
                        \noalign{\kern2mm}
                        \mathtt{f}_{(\varpi+1)\,1} & \Cdots & \mathtt{f}_{(\varpi+1)\,\varpi} & \mathtt{f}_{(\varpi+1)\,(\varpi+1)} & \Cdots & \mathtt{f}_{(\varpi+1)\,\eta} %
                        \\
                        \Vdots & & \Vdots & \Vdots & \Ddots & \Vdots %
                        \\
                        \mathtt{f}_{\eta\,1} & \Cdots & \mathtt{f}_{\eta\,\varpi} & \mathtt{f}_{\eta\,(\varpi+1)} & \Cdots & \mathtt{f}_{\eta\,\eta} %
                    \end{bNiceMatrix}%
                \endgroup%  
            \end{aligned}   
        \end{gather}
        \endgroup
%   \end{subequations}
\end{small}


\end{document}

2

You can use the code-after hook to add the brace.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing,calligraphy}

\begin{document}

\begin{small}           
%   \begin{subequations}
        \begingroup
        \allowdisplaybreaks
        \begin{gather}
            \begin{aligned} 
                \boldsymbol{\mathcal{F}}^{i} & = %
                \begingroup
                    \begin{bNiceMatrix}[%
                    margin,
                    nullify-dots,
                    code-after = {\begin{tikzpicture}[
                        decoration={calligraphic brace, amplitude=6pt,raise=2pt}]
                    \draw[decorate,thick] (1-1.north west) -- (1-3.north east)
                    node[midway,above=1.5ex]{$\scriptstyle\mathcal{F}_N^i$};
                    \end{tikzpicture}}
                    ]
                        \mathtt{f}_{1\,1} & \Cdots & \mathtt{f}_{1\,\varpi} & \mathtt{f}_{1\,(\varpi+1)} & \Cdots & \mathtt{f}_{1\,\eta} %
                        \\
                        \Vdots & \Ddots & \Vdots & \Vdots & & \Vdots %  
                        \\
                        \mathtt{f}_{\varpi\,1} & \Cdots & \mathtt{f}_{\varpi\,\varpi} & \mathtt{f}_{\varpi\,(\varpi+1)} & \Cdots & \mathtt{f}_{\varpi\,\eta} %
                        \\
                        \noalign{\kern2mm}
                        \mathtt{f}_{(\varpi+1)\,1} & \Cdots & \mathtt{f}_{(\varpi+1)\,\varpi} & \mathtt{f}_{(\varpi+1)\,(\varpi+1)} & \Cdots & \mathtt{f}_{(\varpi+1)\,\eta} %
                        \\
                        \Vdots & & \Vdots & \Vdots & \Ddots & \Vdots %
                        \\
                        \mathtt{f}_{\eta\,1} & \Cdots & \mathtt{f}_{\eta\,\varpi} & \mathtt{f}_{\eta\,(\varpi+1)} & \Cdots & \mathtt{f}_{\eta\,\eta} %
                    \end{bNiceMatrix}%
                \endgroup%  
            \end{aligned}   
        \end{gather}
        \endgroup
%   \end{subequations}
\end{small}

\end{document}

enter image description here

If you want to also add the pmatrix braces as in your screen shot, you can do the following.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\tikzset{block matrix/.style={path picture={
\draw ([xshift=#1,yshift=\pgflinewidth/2]path picture bounding box.south west)
 -| ([xshift=\pgflinewidth/2,yshift=-\pgflinewidth/2]path picture bounding box.north west)
  -- ++ (#1-\pgflinewidth/2,0)
  ([xshift=-#1,yshift=\pgflinewidth/2]path picture bounding box.south east)
 -| ([xshift=-\pgflinewidth/2,yshift=-\pgflinewidth/2]path picture bounding box.north east)
  -- ++ (-#1+\pgflinewidth/2,0);
}},block matrix/.default=0.8ex}
\begin{document}

\begin{small}           
%   \begin{subequations}
        \begingroup
        \allowdisplaybreaks
        \begin{gather}
            \begin{aligned} 
                \boldsymbol{\mathcal{F}}^{i} & = %
                \begingroup
                    \begin{bNiceMatrix}[%
                    margin,
                    nullify-dots,
                    code-after = {\begin{tikzpicture}[
                        decoration={calligraphic brace, amplitude=6pt,raise=2pt}]
                    \node[inner xsep=1ex,fit=(1-1) (3-3),block matrix,thick](block){};
                    \draw[decorate,thick] (block.north west) -- (block.north east)
                    node[midway,above=1.5ex]{$\scriptstyle\mathcal{F}_N^i$};
                    \end{tikzpicture}}
                    ]
                        \mathtt{f}_{1\,1} & \Cdots & \mathtt{f}_{1\,\varpi} & \mathtt{f}_{1\,(\varpi+1)} & \Cdots & \mathtt{f}_{1\,\eta} %
                        \\
                        \Vdots & \Ddots & \Vdots & \Vdots & & \Vdots %  
                        \\
                        \mathtt{f}_{\varpi\,1} & \Cdots & \mathtt{f}_{\varpi\,\varpi} & \mathtt{f}_{\varpi\,(\varpi+1)} & \Cdots & \mathtt{f}_{\varpi\,\eta} %
                        \\
                        \noalign{\kern2mm}
                        \mathtt{f}_{(\varpi+1)\,1} & \Cdots & \mathtt{f}_{(\varpi+1)\,\varpi} & \mathtt{f}_{(\varpi+1)\,(\varpi+1)} & \Cdots & \mathtt{f}_{(\varpi+1)\,\eta} %
                        \\
                        \Vdots & & \Vdots & \Vdots & \Ddots & \Vdots %
                        \\
                        \mathtt{f}_{\eta\,1} & \Cdots & \mathtt{f}_{\eta\,\varpi} & \mathtt{f}_{\eta\,(\varpi+1)} & \Cdots & \mathtt{f}_{\eta\,\eta} %
                    \end{bNiceMatrix}%
                \endgroup%  
            \end{aligned}   
        \end{gather}
        \endgroup
%   \end{subequations}
\end{small}

\end{document}

enter image description here

| improve this answer | |
  • Great solution. It is exactly what I want. Thank you for help. – Adriano Feb 7 at 2:21

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.