## LaTeX forum ⇒ TeXShop ⇒ Package pgfkeys Error

Information and discussion about TeXShop, an integrated LaTeX environment for Mac OS X
jay_singh
Posts: 5
Joined: Tue Jul 14, 2020 6:27 pm

### Package pgfkeys Error

Hello friends,
I'm trying to draw a 2 dimensional matrix, quite simple, nothing so fancy. The only thing I am trying extra is format the first row, (get red colored texts there) as per this code;

\usepackage{tikz}\usetikzlibrary{matrix,backgrounds}\usepackage{pgfplots}\pgfplotsset{compat=1.16}\begin{document}\begin{center}\begin{tikzpicture}[ row 1/ .style={red}]\matrix{\node{2}; & \node{3}; & \node{4}; & \node{4}; & \node{3}; \\\node{0}; & \node{1}; & \node{2}; & \node{3}; & \node{4};\\ };\end{tikzpicture}\end{center}\end{document}

I looked at some tikz documentation and it seems I have the required packages. But I am getting following error;
Package pgfkeys error: I do not know the key 'tikz/ row 1/ .style, to which you passed red and I am going to ignore it.

Can I please get help on how to modify or format selected row/column of the matrix above. Help is appreciated.

Bartman
Posts: 96
Joined: Fri Jan 03, 2020 2:39 pm
Remove the space between the slash and the dot of the style for the first row.

It is less work to fill the matrix with content, if you use the options matrix of nodes or matrix of math nodes. Both options require the matrix library.

pgfplots loads tikz. If you are using an up-to-date version of pgfplots, then you can use compatibility level 1.17.

jay_singh
Posts: 5
Joined: Tue Jul 14, 2020 6:27 pm
Appreciate your advice. Removing the space works.

Couple of questions I had with the remarks you suggested;
First, if I load pgfplots using \usepackage{pgfplots}, then does it automatically load tikz package also. Can you kindly explain?

Second, you mentioned that it is better to use compatibility level 1.17 if pgfplots is up todate. May I know how can I check the version of pgfplots in my texshop settings?

Third regarding importing matrix library, isn't that essentially what I have in my preamble;

\usetikzlibrary{matrix,backgrounds}
Kindly let me know if I'm missing sth here. Or is there a better way to import matrix library. Your suggestions are welcome.

Your help is appreciated.

Bartman
Posts: 96
Joined: Fri Jan 03, 2020 2:39 pm
The necessary information about TikZ and the compatibility level is explained in the pgfplots documentation.

I mentioned the matrix library as a precaution, because some users overlook the fact that parts of the source code need at least one specific TikZ library.