4

Can I make a matrix from just a parts of the cells?
i.e. not all the cells just some of it, like here:

enter image description here

It possible to make something like this?

Thank you!!

P.S. I'm using LyX.

heblyx
  • 2,571
  • Of course it is possible :-). At least drawing it as tikz picture or use package nicematrix, etc. What you try so far? – Zarko Jul 27 '19 at 17:57
  • I'm using LyX - So I tried to put it at some cells and I didn't succeed this why I'm asking here... – heblyx Jul 27 '19 at 17:58
  • Sorry, I'm not familiar with LyX. – Zarko Jul 27 '19 at 17:59
  • @Zarko, thanks! but at TikZ it very complicated, no? – heblyx Jul 27 '19 at 18:00
  • 1
    blkarray perhaps (e.g. https://tex.stackexchange.com/questions/30791/array-with-labeling-columns/30792#30792, there are more examples on the site). You would have to write the code manually though, I don't think LyX has implemented support for blkarray. – Torbjørn T. Jul 27 '19 at 18:00
  • @Zarko, do you know how to write this array (above) at nicematrix? – heblyx Jul 27 '19 at 18:07

2 Answers2

7

The blkarray package makes it particularly easy:

\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}

\begin{document}

\[
\begin{blockarray}{*{5}{c}} 
1 & 7 & 8 & 6 & 52 \\
\begin{block}{c[ccc]c}
3 & 17 & 9 & 9 & 1 \\
 12 & 10 & 9 & 6 & 5 \\
\end{block}
1 & 2 & 2 & 4 & 5
\end{blockarray}
\]

\end{document} 

enter image description here

Bernard
  • 271,350
2

You can easily do that with {bNiceMatrix} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{bNiceMatrix}[first-row,first-col,last-row,last-col] 1 & 7 & 8 & 6 & 52 \ 3 & 17 & 9 & 9 & 1 \ 12 & 10 & 9 & 6 & 5 \ 1 & 2 & 2 & 4 & 5 \end{bNiceMatrix}$

\end{document}

Output of the first code

With nicematrix, you have also tools to put delimiters exactly where you want.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{NiceMatrix} 1 & 7 & 8 & 6 & 52 \ 3 & 17 & 9 & 9 & 1 \ 12 & 10 & 9 & 6 & 5 \ 1 & 2 & 2 & 4 & 5 \CodeAfter \SubMatrix[{2-2}{3-3}] \end{NiceMatrix}$

\end{document}

Output of the second code

F. Pantigny
  • 40,250