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

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

NiceMatrix: Error when using large matrices with Block-Command

Postby Tetrahedron » Fri Mar 20, 2020 10:20 am

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] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{article}
  2.  
  3. \usepackage{amsmath}
  4. \setcounter{MaxMatrixCols}{15}
  5.  
  6. \usepackage[latin1]{inputenc}
  7.  
  8. \usepackage{nicematrix}
  9.  
  10. \begin{document}
  11.  
  12. \begin{equation}
  13. \begin{bNiceArray}{CCC|CCC|CCCCC}[first-row,first-col]
  14. & a & b & c & d & e & f & g & h & i & j & k \\
  15. a & \Block{3-3}{A} & & & \Block{3-3}{B} & & & \Block{3-3}{C} & & & & \\ % does compile
  16. b & & & & & & & & & & & \\
  17. c & & & & & & & & & & & \\
  18. d & \Block{3-3}{D} & & & \Block{3-3}{E} & & & 0 & 0 & 0 & 0 & 0 \\
  19. e & & & & & & & 0 & 0 & 0 & 0 & 0 \\
  20. f & & & & & & & 1 & 0 & 0 & 0 & 0 \\
  21. g & 0 & 0 & 0 & \Block{3-3}{F} & & & 0 & 1 & 0 & 0 & 0 \\
  22. h & 0 & 0 & 0 & & & & 0 & 0 & 1 & 0 & 0 \\
  23. i & 0 & 0 & 0 & & & & 0 & 0 & 0 & 1 & 0 \\
  24. j & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
  25. \end{bNiceArray}
  26. \end{equation}
  27.  
  28. \end{document}


Not working:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{article}
  2.  
  3. \usepackage{amsmath}
  4. \setcounter{MaxMatrixCols}{15}
  5.  
  6. \usepackage[latin1]{inputenc}
  7.  
  8. \usepackage{nicematrix}
  9.  
  10. \begin{document}
  11.  
  12. \begin{equation}
  13. \begin{bNiceArray}{CCC|CCC|CCCCC}[first-row,first-col]
  14. & a & b & c & d & e & f & g & h & i & j & k \\
  15. a & \Block{3-3}{A} & & & \Block{3-3}{B} & & & \Block{3-5}{C} & & & & \\ % does not compile
  16. b & & & & & & & & & & & \\
  17. c & & & & & & & & & & & \\
  18. d & \Block{3-3}{D} & & & \Block{3-3}{E} & & & 0 & 0 & 0 & 0 & 0 \\
  19. e & & & & & & & 0 & 0 & 0 & 0 & 0 \\
  20. f & & & & & & & 1 & 0 & 0 & 0 & 0 \\
  21. g & 0 & 0 & 0 & \Block{3-3}{F} & & & 0 & 1 & 0 & 0 & 0 \\
  22. h & 0 & 0 & 0 & & & & 0 & 0 & 1 & 0 & 0 \\
  23. i & 0 & 0 & 0 & & & & 0 & 0 & 0 & 1 & 0 \\
  24. j & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
  25. \end{bNiceArray}
  26. \end{equation}
  27.  
  28. \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] [Expand/Collapse] [Download] ({untitled.tex})
  1. 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!

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

Postby mas » Sun Mar 22, 2020 3:04 am

It is working as expected.

x.png
x.png (9.03 KiB) Viewed 147 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

Postby Tetrahedron » Mon Mar 23, 2020 9:33 am

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

Postby Tetrahedron » Mon Mar 23, 2020 4:43 pm

This is a bug in NiceMatrix 3.13

The author will fix it in the update 3.14


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests