Graphics, Figures & TablesNiceMatrix: Error when using large matrices with Block-Command

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Tetrahedron
Posts: 3
Joined: Fri Mar 20, 2020 9:55 am

NiceMatrix: Error when using large matrices with Block-Command

Post by Tetrahedron »

First of all, hey guys and thanks :-)

The problem occurs when using the NiceMatrix-Package with the \Block-Command. It seems like there is a problem, if the matrix-indicies that the block covers exceed 10.

First of all, a working example:

Code: Select all

\documentclass[12pt]{article}

\usepackage{amsmath}
\setcounter{MaxMatrixCols}{15}

\usepackage[latin1]{inputenc}

\usepackage{nicematrix}

\begin{document}

\begin{equation}
\begin{bNiceArray}{CCC|CCC|CCCCC}[first-row,first-col]
	  & a & b & c & d & e & f & g & h & i & j & k \\
	a & \Block{3-3}{A} & & & \Block{3-3}{B} & & & \Block{3-3}{C} & & & & \\ % does compile
	b & & & & & & & & & & & \\
	c & & & & & & & & & & & \\
	d & \Block{3-3}{D} & & & \Block{3-3}{E} & & & 0 & 0 & 0 & 0 & 0 \\ 
	e & & & & & & & 0 & 0 & 0 & 0 & 0 \\
	f & & & & & & & 1 & 0 & 0 & 0 & 0 \\
	g & 0 & 0 & 0 & \Block{3-3}{F} & & & 0 & 1 & 0 & 0 & 0 \\
	h & 0 & 0 & 0 & & & & 0 & 0 & 1 & 0 & 0 \\
	i & 0 & 0 & 0 & & & & 0 & 0 & 0 & 1 & 0 \\
	j & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 
\end{bNiceArray}
\end{equation}

\end{document}
Not working:

Code: Select all

\documentclass[12pt]{article}

\usepackage{amsmath}
\setcounter{MaxMatrixCols}{15}

\usepackage[latin1]{inputenc}

\usepackage{nicematrix}

\begin{document}

\begin{equation}
\begin{bNiceArray}{CCC|CCC|CCCCC}[first-row,first-col]
	  & a & b & c & d & e & f & g & h & i & j & k \\
	a & \Block{3-3}{A} & & & \Block{3-3}{B} & & & \Block{3-5}{C} & & & & \\ % does not compile
	b & & & & & & & & & & & \\
	c & & & & & & & & & & & \\
	d & \Block{3-3}{D} & & & \Block{3-3}{E} & & & 0 & 0 & 0 & 0 & 0 \\ 
	e & & & & & & & 0 & 0 & 0 & 0 & 0 \\
	f & & & & & & & 1 & 0 & 0 & 0 & 0 \\
	g & 0 & 0 & 0 & \Block{3-3}{F} & & & 0 & 1 & 0 & 0 & 0 \\
	h & 0 & 0 & 0 & & & & 0 & 0 & 1 & 0 & 0 \\
	i & 0 & 0 & 0 & & & & 0 & 0 & 0 & 1 & 0 \\
	j & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 
\end{bNiceArray}
\end{equation}

\end{document}
Of course, the matrix C should be the size 3-5 instead of 3-3 to cover the empty space inside the matrix. But after replacing "\Block{3-3}{C}" with "\Block{3-5}{C}" (that is the only difference between the two examples), I get the following error message:

Code: Select all

Package pgf Error: No shape named `nm-1-col-21' is known. \end{bNiceArray}
I would be really happy, if there's a work-around or similar for that.

Thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

NiceMatrix: Error when using large matrices with Block-Command

Post by mas »

It is working as expected.
x.png
x.png (9.03 KiB) Viewed 3029 times
First I tried your working example. CHanged 3 to 5; it worked. Copied your "non-working" code. That also compiled without any errors.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
Tetrahedron
Posts: 3
Joined: Fri Mar 20, 2020 9:55 am

NiceMatrix: Error when using large matrices with Block-Command

Post by Tetrahedron »

Thanks for your replay.

The problem occurs with version 3.13 of NiceMatrix.

It seems, like there are no problems with 3.11 and older... which version did you use?
Tetrahedron
Posts: 3
Joined: Fri Mar 20, 2020 9:55 am

NiceMatrix: Error when using large matrices with Block-Command

Post by Tetrahedron »

This is a bug in NiceMatrix 3.13

The author will fix it in the update 3.14
Post Reply