I draw lots of block diagrams like this one (source below):
The arrow drawing contains a lot of repetitive \draw[->] commands, and I'm wondering: is there any way to create a shortcut so that this
\draw[->] (x) -- (sum6);
\draw[->] (sum6) -- (K0);
\draw[->] (dot5) -- (Kp);
\draw[->] (dot5) |- (Ki);
\draw[->] (Kp) -- (sum7);
\draw[->] (Ki) -- (int3);
\draw[->] (int3) -- (dot4) -- (sum7);
\draw[->] (sum7) -- (int2);
\draw[->] (int2) -- (sum6);
\draw[->] (dot4) -- (w_e);
\draw[-] (K0) -| ++(12mm,-12mm) -| (dot5);
could be replaced with this (arrowheads inline rather than in each \draw command option):
\draw[arrowcontext]
(x) --> (sum6) --> (K0) -| ++(12mm,-12mm) -| (dot5)
--> (Kp) --> (sum7) --> (int2) --> (sum6)
(dot5) |-> (Ki) --> (int3) -- (dot4) --> (sum7)
(dot4) --> (w_e);
full source:
\documentclass[border=6mm]{standalone}
\usepackage{tikz}
\usepackage{nccmath}
\usetikzlibrary{shapes,shadows,arrows,positioning,calc}
\begin{document}
\begin{tikzpicture}[node distance=5mm, auto,
blockcolors/.style={
% The rest
thick,draw=black,
top color=white,
bottom color=black!10,
font=\sffamily\small
},
blockheight/.style = {
minimum height=10mm
},
block/.style={
% The shape:
rectangle, minimum size=6mm, minimum width=12mm,
blockheight,
node distance=5mm,
blockcolors,
drop shadow
},
phantom/.style={
},
open circle/.style={
circle, inner sep=0pt,
thick,draw=black,
fill = white,
},
input/.style={open circle, minimum size=2mm, node distance=8mm, fill=green!70!black},
output/.style={input},
junction/.style={open circle, minimum size=0.5mm,fill=black, node distance=5mm},
sum/.style={open circle, minimum size=4mm, node distance=8mm},
gain/.style={
draw,
shape border rotate=-90,
inner sep=0.5mm,
regular polygon,
regular polygon sides=3,
blockcolors, drop shadow
},
every label/.style={
font=\sffamily\scriptsize
},
>=latex
]
\def\NEAR{4.0mm of }
\node (x) [input, label={[font=\normalsize]$x$}] {};
\node (sum6) [sum, below=of x] {};
\node (K0) [gain, inner sep=0mm, right=6mm of sum6]{$K_0$};
\node (int2) [block, left=7mm of sum6]{$\medint\int dt$};
\node (sum7) [sum, left=\NEAR int2] {};
\node (dot4) [junction] at (x -| sum7){};
\node (int3) [block, left=of dot4]{$\medint\int dt$};
\node (Ki) [gain, left=of int3, inner sep=-0.4mm] {$K_I$};
\node (Kp) [gain, inner sep=-0.65mm] at (Ki |- sum7){$K_P$};
\node (dot5) [junction, left=of Kp]{};
\node (w_e) [output, right=of dot4, label={[font=\normalsize]above:$\hat{\omega}_e$}]{};
\draw[->] (x) -- (sum6);
\draw[->] (sum6) -- (K0);
\draw[->] (dot5) -- (Kp);
\draw[->] (dot5) |- (Ki);
\draw[->] (Kp) -- (sum7);
\draw[->] (Ki) -- (int3);
\draw[->] (int3) -- (dot4) -- (sum7);
\draw[->] (sum7) -- (int2);
\draw[->] (int2) -- (sum6);
\draw[->] (dot4) -- (w_e);
\draw[-] (K0) -| ++(12mm,-12mm) -| (dot5);
\end{tikzpicture}
\end{document}


-->useto– percusse Sep 27 '16 at 17:20|->and-|>cases? – Jason S Sep 27 '16 at 17:21--andtoseem to have the same effect, they don't give me multiple arrows for a given\draw[->]command – Jason S Sep 27 '16 at 17:25chainslibrary of tikz? That way you could avoid most of the draw commans alltogether as longs as all the elements are connected to a chain. – Robert Seifert Sep 28 '16 at 07:08