# tikz postaction using edge

## Problem

I want to add a tikz style which affects only some arrows in a large diagram, and adds a postaction. I also need to bend and label these arrows, so many are created using the edge command.

However, as noted in this Tikz manual (pp 131, section 13.11), edge paths are computed after the main path. As a result (I think), postaction fails on edge arrows.

## Question

Can I use postaction on edge paths? If so, how?

## Example

\documentclass{standalone}
\usepackage{tikz}
\tikzset{
arrow/.style = { -stealth, red, line width = 2mm,
postaction = { draw, blue, line width = 1mm, shorten >=1mm }
}
}
\begin{document}
\begin{tikzpicture}
\draw[arrow] (0,0)  --  (+1,+1);
\draw[arrow] (0,0) edge (-1,-1);
\end{tikzpicture}
\end{document}


### Desired

• you can but you have to add to the edge options not the draw – percusse Jun 20 '18 at 14:28
• This gives the error: Package pgfkeys Error: I do not know the key '/tikz/edge' and I am going to ignore it. Perhaps you misspelled it. \draw[arrow] (0,0) -- (+1,+); – Jesse Knight Jun 20 '18 at 14:36
• Just restating what @percusse said: try \draw (0,0) edge[arrow] (-1,-1);. – marmot Jun 20 '18 at 14:38

You have to apply the arrow style to the edges not to the whole path. For this you can use every edge style. And as said @percusse in his comment you have to add draw in the style.

\documentclass{standalone}
\usepackage{tikz}
\tikzset{
arrow/.style = {-stealth, draw=red, line width = 2mm,
postaction = { draw=blue, line width = 1mm, shorten >=1mm }
},
earrow/.style={
every edge/.style={arrow}
}
}
\begin{document}
\begin{tikzpicture}
\draw[arrow] (0,0)  --  (+1,+1);
\draw[earrow] (0,0) edge (-1,-1);
\end{tikzpicture}
\end{document}


I think the correct way to get what you want is defining the start and end using <arrow_tip>-<arrow_tip>, normally is <->, but for your style should be stealth-stealth.

RESULT:

MWE:

\documentclass[border=20pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{
arrow/.style = {
draw,
red,
stealth-stealth,
line width = 2mm,
postaction = {
draw,
blue,
line width = 1mm,
shorten >=1mm,
shorten <=1mm,
stealth-stealth
}
}
}
\begin{document}
\begin{tikzpicture}
\draw[arrow] (-1,-1)  --  (1,1);
\draw[arrow] (1,-1)  -|  (3,1);
\draw[arrow] (4,-1)  .. controls +(right:2cm) and +(down:2cm) .. (6,1);
\end{tikzpicture}
\end{document}

• Sorry, I should have clarified. I don't want to draw two-headed arrows. I was just using this example to contrast the results of -- and edge – Jesse Knight Jun 20 '18 at 14:58