TeX - LaTeX Asked on June 23, 2021
I would like to create a matrix that consists of 9 blocks (3×3), and each block is 3×3 too. Within and between the blocks I need a lot of dots. Each block has Cdots
, Vdots
and Ddots
, and these are also in the ‘middle’ blocks. I hope my example below will make this more clear. I have a MWE with an image of the output it creates, and an image on which I’ve highlighted how I’d expect the lines to be given my input.
documentclass{article}
usepackage{nicematrix}
begin{document}
begin{equation*}
tilde{Sigma}_w = begin{bNiceMatrix}
C[w_1,w_1] & Cdots & C[w_1,w_n] & & & & C[w_1,w_1^{(p)}] & Cdots & C[w_1,w_n^{(p)}]
Vdots & Ddots & Vdots & Cdots & Cdots & Cdots & Vdots & Ddots & Vdots
C[w_n,w_1] & Cdots & C[w_n,w_n] & & & & C[w_n,w_1^{(p)}] & Cdots & C[w_n,w_n^{(p)}]
& Vdots && Ddots &&&& Vdots &
& Vdots &&& Ddots &&& Vdots &
& Vdots &&&& Ddots && Vdots &
C[w_1^{(p)},w_1] & Cdots & C[w_1^{(p)},w_n] & & & & C[w_1^{(p)},w_1^{(p)}] & Cdots & C[w_1^{(p)},w_n^{(p)}]
Vdots & Ddots & Vdots & Cdots & Cdots & Cdots & Vdots & Ddots & Vdots
C[w_n^{(p)},w_1] & Cdots & C[w_n^{(p)},w_n] & & & & C[w_n^{(p)},w_1^{(p)}] & Cdots & C[w_n^{(p)},w_n^{(p)}]
end{bNiceMatrix}
end{equation*}
end{document}
Expected output. Red is wrong, green is missing:
What am I doing wrong?
Here is a solution.
documentclass{article}
usepackage{nicematrix}
begin{document}
begin{equation*}
tilde{Sigma}_w = begin{bNiceMatrix}
C[w_1,w_1] & Cdots & C[w_1,w_n] & & & & C[w_1,w_1^{(p)}] & Cdots & C[w_1,w_n^{(p)}]
Vdots & Ddots & Vdots & Cdots & Cdots & Cdots & Vdots & Ddots & Vdots
C[w_n,w_1] & Cdots & C[w_n,w_n] & & & & C[w_n,w_1^{(p)}] & Cdots & C[w_n,w_n^{(p)}]
& Vdotsfor{3} & & & & & & Vdotsfor{3}
& & & & Ddots & & &
C[w_1^{(p)},w_1] & Cdots & C[w_1^{(p)},w_n] & & & & C[w_1^{(p)},w_1^{(p)}] & Cdots & C[w_1^{(p)},w_n^{(p)}]
Vdots & Ddots & Vdots & Cdots & Cdots & Cdots & Vdots & Ddots & Vdots
C[w_n^{(p)},w_1] & Cdots & C[w_n^{(p)},w_n] & & & & C[w_n^{(p)},w_1^{(p)}] & Cdots & C[w_n^{(p)},w_n^{(p)}]
end{bNiceMatrix}
end{equation*}
end{document}
Remarks:
nicematrix
can't be nested (which would be useful in this situation). Maybe in a future version.Codts
, Vdots
, etc. are drawn between non-empty cells or the borders of the array. That's why it's difficult to draw the vertical dotted lines belonging to the main matrix.Vdotsfor
similar to Hdotsfor
perfect for that job. In fact, as of now, this command was not documented in nicematrix
because I was not sure of its utility. Now, I will documente it and it will remain in the future versions of the package :-)Correct answer by F. Pantigny on June 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP