I would like to create a partial block matrix, with two blocks on the bottom row, separated by a vertical line between them, and separated from the rest of the matrix by a horizontal line.
My first attempt captured the idea, but the alignment was lacking
\documentclass{article}\usepackage{amsmath}\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}\newcommand{\bigid}{\mbox{\normalfont\Large\bfseries I}}\begin{document} \begin{equation*} \begin{pmatrix} \begin{matrix} 1 & x_0 & x_0^2 & \dots & x_0^n \\ & & \vdots & & \\ 1 & x_m & x_m^2 & \dots & x_m^n \\ \end{matrix} \\ \hline \begin{array}{c c | c c c} \bigzero & & & \bigid_{n-m} & \end{array} \end{pmatrix} \end{equation*}\end{document}Ideally, I would like a little more space between the horizontal line and the rows. Furthermore, the0 should be centred between the first two columns, while theI should be centred between the last three columns.
I was able to obtain a much better spacing using thenicematrix package, however I have no idea how to produce the vertical line, whichshould join with the horizontal line but not spread into the first three rows.
\documentclass{article}\usepackage{amsmath}\usepackage{nicematrix}\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}\newcommand{\bigid}{\mbox{\normalfont\Large\bfseries I}}\begin{document} \begin{equation*} \begin{pNiceArray}{CCCCC} 1 & x_0 & x_0^2 & \cdots & x_0^n \\ & & \Vdots & & \\ 1 & x_m & x_m^2 & \cdots & x_m^n \\ \hline \Block{2-2}{\bigzero} & & \Block{2-3}{\bigid_{n-m}} & \\ & & & & \end{pNiceArray} \end{equation*}\end{document}- There is a typo in your code: you wrote
{\bigid_{n-m})instead of{\bigid_{n-m}}.F. Pantigny– F. Pantigny2020-04-21 13:27:14 +00:00CommentedApr 21, 2020 at 13:27 - Possibly related:tex.stackexchange.com/questions/99238/compact-block-matrixsteve– steve2020-04-21 13:52:33 +00:00CommentedApr 21, 2020 at 13:52
- @ABlueChameleon I read that question while doing my due diligence, but not only it is not immediately clear how to adapt the answer to this particular case, it also seems a lot more convoluted than using
nicematrix.A.P.– A.P.2020-04-22 09:51:53 +00:00CommentedApr 22, 2020 at 9:51 - 1@A.P. I didn't mean to say that I thought this was a duplicate or anything, but rather that if someone was looking for ways to typeset block matrices, there were additional options over there.steve– steve2020-04-22 09:54:34 +00:00CommentedApr 22, 2020 at 9:54
2 Answers2
You can draw the rule you want with a TikZ instruction:
\documentclass{article}\usepackage{nicematrix}\usepackage{tikz}\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}\newcommand{\bigid}{\mbox{\normalfont\Large\bfseries I}}\begin{document} \begin{equation*} \begin{pNiceMatrix} 1 & x_0 & x_0^2 & \Cdots & x_0^n \\ & & \Vdots & & \\ 1 & x_m & x_m^2 & \Cdots & x_m^n \\ \hline \Block{2-2}{\bigzero} & & \Block{2-3}{\bigid_{n-m}} & \\ & & & & \CodeAfter \tikz \draw (4-|3) -- (6-|3) ; \end{pNiceMatrix} \end{equation*}\end{document}With recent versions ofnicematrix, you can merely use the keyborders of the command\Block:
\documentclass{article}\usepackage{nicematrix}\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}\newcommand{\bigid}{\mbox{\normalfont\Large\bfseries I}}\begin{document} \begin{equation*} \begin{pNiceArray}{ccccc} 1 & x_0 & x_0^2 & \cdots & x_0^n \\ & & \Vdots & & \\ 1 & x_m & x_m^2 & \cdots & x_m^n \\ \Hline \Block[borders=right]{2-2}{\bigzero} & & \Block{2-3}{\bigid_{n-m}} & \\ & & & & \end{pNiceArray} \end{equation*}\end{document}- I miss similar example in package documentation. With some explanation, how vertical line is drawn. Also, is there a way to draw
\hline˙ that it will not touch delimiter parenthesis (use optionmargin move vertical lines between block)?Zarko– Zarko2020-04-21 14:58:42 +00:00CommentedApr 21, 2020 at 14:58 - 1@Zarko: You are right. It's not possible to understand how this answer works because the documentation of
nicematrixis incomplete. I will complete that documentation soon. In a few words, the recent versions ofnicematrixcreate new nodes, a node for each row and a node for each column corresponding to the position of the (potential) rules in the array.F. Pantigny– F. Pantigny2020-04-21 15:12:24 +00:00CommentedApr 21, 2020 at 15:12 - @Zarko: It's not possible to change the horizontal rule created by
\hline. The command\hlinehas not been modified bynicematrix. However, it's possible to use\cmidruleofbooktabsto have an horizontal rule a bit shorter.F. Pantigny– F. Pantigny2020-04-21 15:16:01 +00:00CommentedApr 21, 2020 at 15:16 - Thank you for explanation in the first comment. Solution proposed in second comments works (fine), but to my opinion is to rude. Use simple
\hlinein conjunction withmarginoption, if they will work properly, seems to be more consistent with existed solution (which not use new nodes for rows and columns). Anyway, +1 for answer!Zarko– Zarko2020-04-21 15:35:50 +00:00CommentedApr 21, 2020 at 15:35 - Unfortunately, I cannot get this to run (I copied your code as-is). I get two errors:Undefined control sequence. \CodeAfter andPackage pgf Error: No shape named col-3 is known (plus similar ones for
row-4androw-6. I tried upgradingnicematrixto the latest available revision (54758 according to mytllocalmgr), to no avail.A.P.– A.P.2020-04-22 10:21:39 +00:00CommentedApr 22, 2020 at 10:21
You can also use two instructions\multicolumn:
\documentclass{article}\usepackage{amsmath}\usepackage{nicematrix}\newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}}\newcommand{\bigid}{\mbox{\normalfont\Large\bfseries I}}\begin{document} \begin{equation*} \begin{pNiceMatrix} 1 & x_0 & x_0^2 & \Cdots & x_0^n \\ & & \Vdots & & \\ 1 & x_m & x_m^2 & \Cdots & x_m^n \\ \hline \Block{2-2}{\bigzero} & \multicolumn{1}{C|}{} & \Block{2-3}{\bigid_{n-m}} & \\ & \multicolumn{1}{C|}{} & & & \end{pNiceMatrix} \end{equation*}\end{document}- While I like this solution because it is in a sense simpler in not requiring
tikz, I prefer the more centred alignment of the vertical bar in your other answer.A.P.– A.P.2020-04-22 09:55:40 +00:00CommentedApr 22, 2020 at 9:55
You mustlog in to answer this question.
Explore related questions
See similar questions with these tags.





