# Strange error with tikz arrows

I am trying to get tikz to draw some arrows for me and I keep getting the following error message:

Package pgfkeys Error: I do not know the key '/tikz/line' and I am going to ignore it. Perhaps you misspelled it. \path [line] (


When I try using a test document, everything works well but it does not work in my intended document.

\begin{tikzpicture}[node distance = 5cm, auto]
\node [startstop] (ba) {Block A};
\node [startstop, right of=ba] (bb) {Block B};
\path [line] (ba) -- (bb);
\end{tikzpicture}


Here is the rough structure of my document:

%Some other packages used here
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm,
minimum height=1cm,text centered, draw=black, fill=red!30]
%% Edit Begin %%
\tikzstyle{line} = [draw, -latex']
%% Edit End %%

%% Some matter here

\begin{tikzpicture}[node distance = 5cm, auto]
\node [startstop] (ba) {Block A};
\node [startstop, right of=ba] (bb) {Block B};
%% Works
%% \path [line] (ba) -- (bb);
%% Does not work
\draw [arrow] (ba) -- (bb);
\end{tikzpicture}

%% More matter
\end{document}


Is there something silly that I am missing here?

When I compile the document, I do see the blocks but not the arrows and I have looked into almost all the posts about similar issues on the internet and the issue is typically not using the right \usetikzlibrary commands.

In my case, I am using all the right libraries but I still keep getting this cryptic error message.

--- Edit ---

Added the tikzstyle definition for "line".

When I try to use the inbuilt arrow, I get a similar error message:

Package pgfkeys Error: I do not know the key '/tikz/arrow' and I am going to ignore it. Perhaps you misspelled it. \draw [arrow]

For now, I can proceed using the "line" that I am defining but would be nice to know why the \draw [arrow] does not work.

• You don't have any style called line. At least it's not present in the code you showed to us. Mar 17, 2016 at 19:11
• I'm pretty sure [arrow] isn't a predefined style either, which is why you're getting the exact same error. Mar 17, 2016 at 23:06

The error occurs because there is no default line style for TikZ, even in the libraries you're using. Thus, if you want to use it in your code, you must define it with \tikzstyle. If you adapted your code from a question such as this one, then you should add to your preamble something like \tikzstyle{line}=[draw], which will allow you to use line in your code as follows:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzstyle{line}=[draw] % here
\begin{document}

\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm,
minimum height=1cm,text centered, draw=black, fill=red!30]

\begin{tikzpicture}[node distance = 5cm, auto]
\node [startstop] (ba) {Block A};
\node [startstop, right of=ba] (bb) {Block B};
\path [line] (ba) -- (bb);
\end{tikzpicture}
\end{document}


This will draw a line between the two nodes. If you prefer a different style, you can change the \tikzstyle definition.

• Thanks a lot for your feedback! I have updated the question. After defining the tikzstyle, I am able to draw the arrows as required but I still get an error message while using \draw [arrow]. Would like to know whats up with that one...I have used tikz in the past also but never faced this kind of an issue... Mar 17, 2016 at 19:30
• Have you added \tikzstyle{arrow}=[draw, -latex] to your preamble? Mar 17, 2016 at 20:04

Using: \draw [->] (ba) -- (bb); rather than \draw [arrow] (ba) -- (bb); fixed it for me.