2

New to using Tikz, i created tikz pictures I'd like to include in my latex document but latex keeps giving me a ! Package pgfkeys Error: I do not know the key '/tikz/none' and I am going to ignore it. error because I don't want to color my nodes (no fill or draw color). I just wanted to make a line in my image but to make a line you need to connect two nodes so I don't really need the nodes and would prefer they stay invisible.

\begin{tikzpicture}
    \begin{pgfonlayer}{nodelayer}
        \node [style=none] (0) at (-1.5, 0) {};
        \node [style=none] (1) at (7.5, 0) {};
        \node [style=none] (2) at (-1.5, 1.75) {};
        \node [style=none] (6) at (0, 3) {};
        \node [style=none] (7) at (-0.5, 0) {};
        \node [style=none] (8) at (0, 0) {};
    \end{pgfonlayer}
    \begin{pgfonlayer}{edgelayer}
        \draw (0.center) to (1.center);
        \draw (6.center) to (8.center);
   \end{pgfonlayer}
\end{tikzpicture}

How do I get around this? I made a seperate style file as well but still didn't help.

(Note I'm using a mac app tikzit to make these things)

9
  • if you not like some style for nodes, just dropout this option: node (0) at (-1.5, 0) {};
    – Zarko
    Mar 12, 2020 at 22:36
  • seems better but getting now: ! Package pgf Error: Sorry, the requested layer 'nodelayer' is not part of the even though i have this: \pgfdeclarelayer{edgelayer} \pgfdeclarelayer{nodelayer} \pgfsetlayers{edgelayer, nodelayer}
    – guy
    Mar 12, 2020 at 22:47
  • 1
    This works: \begin{tikzpicture} \pgfdeclarelayer{nodelayer} \pgfdeclarelayer{edgelayer} \pgfsetlayers{main,nodelayer,edgelayer} \begin{pgfonlayer}{nodelayer} \node (0) at (-1.5, 0) {}; \node (1) at (7.5, 0) {}; \node (2) at (-1.5, 1.75) {}; \node (6) at (0, 3) {}; \node (7) at (-0.5, 0) {}; \node (8) at (0, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0.center) to (1.center); \draw (6.center) to (8.center); \end{pgfonlayer} \end{tikzpicture}
    – user194703
    Mar 12, 2020 at 22:58
  • 1
    ... if you wrap it into \documentclass[tikz,border=3mm]{standalone} \begin{document} and \end{document}, say.
    – user194703
    Mar 12, 2020 at 22:59
  • @Schrödinger'scat yep that worked, thanks!
    – guy
    Mar 12, 2020 at 23:09

1 Answer 1

2

To provide an official answer to the problem. As Zarko is saying, if you do not want to add a style, do not add a style, but use none only if you have defined a style of that name. Also, if you use layers, you need to define them.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
    \pgfdeclarelayer{nodelayer} 
    \pgfdeclarelayer{edgelayer}
    \pgfsetlayers{main,nodelayer,edgelayer}
    \begin{pgfonlayer}{nodelayer}
        \node  (0) at (-1.5, 0) {};
        \node  (1) at (7.5, 0) {};
        \node  (2) at (-1.5, 1.75) {};
        \node  (6) at (0, 3) {};
        \node  (7) at (-0.5, 0) {};
        \node  (8) at (0, 0) {};
    \end{pgfonlayer}
    \begin{pgfonlayer}{edgelayer}
        \draw (0.center) to (1.center);
        \draw (6.center) to (8.center);
   \end{pgfonlayer}
\end{tikzpicture}
\end{document}

The ordering of the layers has been guessed here, a common problem when the code in the question is incomplete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.