Graphics, Figures & TablesTikz example with matrix multiplication errors

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
radm70
Posts: 2
Joined: Sun May 23, 2021 2:10 am

Tikz example with matrix multiplication errors

Post by radm70 »

hello all :-)

Im new with tikz library, I would like to use example from :https://texample.net/tikz/examples/matr ... plication/

I try to understand how it works with tikz manual ;-)
Unfortunately provided latex code dont compile in my computer. Even on this page, when I use "Compile with texlive.net" button the same errors are shown. for example:
"Package pgf Error: No shape named `A-3-5' is known." and a lot of similar.

Could someone more experienced help me with this?
I will really appreciate this :-)
thank you

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Tikz example with matrix multiplication errors

Post by Bartman »

Presumably the example worked at that time without generating error messages.

For an error-free run with a LaTeX program of a current TeX distribution, changes are needed.

If you only insert the variable with the index into a matrix cell, then a node name is created because of the matrix of math nodes option. The \node command, which is inserted into a cell in the example, does not assign a name.

If you then want to draw something using these node names, you would have to replace, for example,

Code: Select all

\node [node style sp] {a_{21}};
by

Code: Select all

|[node style sp]| a_{21}
or

Code: Select all

\node [node style sp] 
    (\tikzmatrixname-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn) {a_{21}};
Of course, you could create a short command for the second variant, but why when the first variant already offers a short solution. ;)

Yes, there is a third variant, but the reader would have to jump back and forth between the options and the content of the matrix to keep track of the context.

The option of the \matrix command in this case would be

Code: Select all

row 2 column 1/.style={nodes=node style sp}

while a_{21} is sufficient as cell content.
Last edited by Bartman on Mon May 24, 2021 6:46 pm, edited 1 time in total.
radm70
Posts: 2
Joined: Sun May 23, 2021 2:10 am

Tikz example with matrix multiplication errors

Post by radm70 »

I need learn a lot :-) thank you very much Bartman, beer for you :D
User avatar
Stefan Kottwitz
Site Admin
Posts: 10310
Joined: Mon Mar 10, 2008 9:44 pm

Tikz example with matrix multiplication errors

Post by Stefan Kottwitz »

Thanks @Bartman, I fixed the example on TeXample.net. It also compiles there when the button Compile with TeXlive.net is clicked, so with the most recent TeX Live 2021.

Stefan
LaTeX.org admin
Post Reply