This is exactly why the Cap arrow tips of the arrows.meta
library were made:
Recall that a cap is a way of ending a line. The graphic languages underlying TikZ (PDG, PostScript or SVG) all support three basic types of line caps on a very low level: round, rectangular, and “butt”. Using cap arrow tips, you can add new caps to lines and use different caps for the end and the start.
However, while the true caps round
and rect
extend over the actual points of the path, the Cap arrow tips (like all default arrow tips) will only touch these points.
This is either actually exactly what you want in the first place or a bit confusing when combined with the real caps.
However, we can alter the Cap tips a bit to act like real caps (the one with '
).
Though, again, that's probably not what you want.
In the second picture below, you can see using two kinds of Caps for connecting multiple nodes. It's usually always better to use separate paths for connecting nodes, especially when dealing with arrow tips (edge
s create separate paths).
Since using the Butt Cap has no advantage over the butt cap unless you need it to be an arrow tip, I'm using two kinds of arrow tips in this example.
Code
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta}
\colorlet{Green}{green!70!black}
\colorlet{Red} {magenta!70!black}
\tikzset{cap or left arrow/.code=% don't use this
\ifcsname pgfset#1cap\endcsname\csname pgfset#1cap\endcsname\def~{cap}\else
\pgfsetarrowsstart{#1[Red]}\def~{\textcolor{Red}{tip}}\fi}
\begin{document}
\tikz[line width=5mm, x=3cm, y=1.5cm, no/.tip=,
Butt Cap'/.tip = {Butt Cap[sep = 0 +-.5]},
Round Cap'/.tip = {Round Cap[sep = 0 +-.5]}]
\foreach[count=\i] \cap in {butt, rect, round, Butt Cap, Butt Cap', Round Cap, Round Cap'}
\foreach[count=\j] \Arrow in {no, Butt Cap, Butt Cap', Round Cap, Round Cap'}
\path[shift={(\j, \i)}]
(-.5cm, -.5cm) edge[help lines, to path=grid(\tikztotarget)](2.5cm,.5cm)
(0, 0) edge[-{\Arrow[Green]}, cap or left arrow=\cap]
node[above=3mm, scale=.5]{\texttt{\cap} ~ -- \texttt{\Arrow} \color{Green}tip}
+(right:2cm);
\tikz\matrix[column sep=5mm]{
\node foreach[count=\i]\t in {A, B, C} [draw, circle] (\t) at (\i*60:3) {\t};
\path[Round Cap - Triangle Cap, line width=5mm]
(A) edge (B)
(B) edge (C)
(C) edge[bend right] node[sloped, white]{Round Cap} (A);
&
\node foreach[count=\i]\t in {A, B, C} [draw, circle] (\t) at (\i*60:3) {\t};
\path[line cap=round, - Triangle Cap, line width=5mm]
(A) edge (B)
(B) edge (C)
(C) edge[bend right] node[sloped, white]{round cap} (A);
\\};
\end{document}
Output


B
(i.e.B
is a coordinate) or disconnected (B
is a node). In the latter, you should use two separate paths (or edges).