I'm basically asking this question, because the answer there is not working for the case with --
lines.
Say you have a line like so:
\draw (0,0) -- (3,3) node[sloped, midway,above]{Hey!};
Then is it possible to make a style such that the code below produces the same result as above?
\draw[heyEnd](0,0) -- (3,3);
I suspect that it should be very possible, because arrow tips makes this effect.
Full example:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzset{
heyEnd/.style={
every edge/.style={
edge node={node[sloped, midway,above]{Hey!}},
draw
}
}
}
%% Intended result:
% \draw (0,0) -- (3,3) node[sloped, midway,above]{Hey!};
%% This works:
% \draw[heyEnd](0,0) edge (3,3);
% This does not, but I want it to
\draw[heyEnd](0,0) -- (3,3);
\end{tikzpicture}
\end{document}
(Possibly) related:
edge
is equivalent to--
. If it is supposed to be equivalent, then I've discovered a bug, heh :) I don't know when one should be used in favour of the other. I do, however, know that--
is often used and I'd like to know how to do this. Mostly for educational purposes. – Andreas Storvik Strauman Jun 17 '18 at 13:42edge
vs--
. They are not supposed to be equivalent :) – Andreas Storvik Strauman Jun 17 '18 at 13:43--
paths using styles :) – Andreas Storvik Strauman Jun 17 '18 at 13:49