# Problem with Round Cap arrow tip and [blank=soft] option (from hobby TikZ library)

I've just found out the Round Cap arrow tip and I wanted to use it to improve a previous answer of mine.

But it doesn't do what I need if there is a [blank=soft] option (from TikZlibrary hobby) in a coordinate of the path.

Look at the arrow tails circled in red in the following MWE.

Indeed, the rounded tail in the second image is the one after the gap!

\documentclass{article}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{hobby, arrows.meta,bending}

\newcommand*{\jdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7) .. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\newcommand*{\gapdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7)
(1.48,.8) ..
([blank=soft]1.43,1.4)
.. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\node[blue, circle, draw, text width=10pt] at (1.43,1.4) {};
\end{tikzpicture}}

\begin{document}
Without \verb|[blank=soft]| is OK:

\jdx

With \verb|[blank=soft]| the rounded end is not where I need it, here I want a rounded end where there is the red circle and a sharp end where there is the blue one:

\gapdx

\end{document}


• Have you tried using line cap=round as option to \draw (seems more intuitive than using arrow tips here)? – TeXnician Feb 17 '19 at 9:53
• @marmot I want {Rounded Cap} draw path {sharp end} gap {sharp beginning} draw path {arrow tip as is}. – CarLaTeX Feb 17 '19 at 10:26

This does not explain the issue and neither does it try to solve it. But you can workaround this limitation by using line cap=round on your path.

\documentclass{article}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{hobby, arrows.meta,bending}

\newcommand*{\jdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7) .. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\newcommand*{\gapdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black,line cap=round, -{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7)
(1.48,.8) ..
([blank=soft]1.43,1.4)
.. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\begin{document}
Without \verb|[blank=soft]|:

\jdx

With \verb|[blank=soft]|:

\gapdx

\end{document}


Edit: As you actually want to have sharp lines except on the ending parts of the path here is another workaround. Please note that this is something different than you asked TikZ to do in the first place.

\documentclass{article}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{hobby, arrows.meta,bending}

\newcommand*{\jdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7) .. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\newcommand*{\gapdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, -{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7) (1.48,.8) .. ([blank=soft]1.43,1.4) .. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\fill (.1,.85) circle (2pt);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\begin{document}
Without \verb|[blank=soft]|:

\jdx

With \verb|[blank=soft]|:

\gapdx

\end{document}

• I didn't know even line cap=round, btw, (+1)! – CarLaTeX Feb 17 '19 at 9:57
• But there is a problem: with line cap=round also the gap limits are rounded. – CarLaTeX Feb 17 '19 at 10:13
• @CarLaTeX Yes, of course. But in your picture one limit was rounded and the other one was not. Do you want that inconsistent style (or should both limits be "sharp")? – TeXnician Feb 17 '19 at 10:15
• Both the limits should be sharp! We have just found out where the Rounded Cap acted! – CarLaTeX Feb 17 '19 at 10:18
• @CarLaTeX Then I agree with marmot that you did ask TikZ to do something different, but for what you're asking I guess the best bet is to separate the two concerns. – TeXnician Feb 17 '19 at 10:25

This is mainly to mention that what you are seeing here is the standard TikZ behavior. That is, IMHO hobby behaves in the way it should. This answer also adds another way to add the rounded cap which is very similar to the second method in TeXnician's nice answer (but does not require you to punch in the coordinates of the circle explicitly).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby, arrows.meta,bending,decorations.markings}

\newcommand*{\jdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7) .. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\end{tikzpicture}}

\newcommand*{\gapdx}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, -{To[angle=90:.3cm 1,length=9mm, flex'=.86]}, line width=4pt,
postaction={decorate,
decoration={markings,mark=at position 0 with {\fill (0,0) circle (2pt) ;}}
}] (.1,.85) to [curve through={(.79,.18) .. (1.45,.7)
(1.48,.8) ..
([blank=soft]1.43,1.4)
.. (1.2,1.6) .. (.9,1.6) .. (1.9,1.6)}]
(2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\node[blue, circle, draw, text width=10pt] at (1.43,1.4) {};
\end{tikzpicture}}

\newcommand*{\standardz}[1][1]{%
\begin{tikzpicture}[baseline, xscale=#1]
\draw[black, {Round Cap}-{To[angle=90:.3cm 1,length=9mm, flex'=.86]},
line width=4pt]
(.1,.85) to[bend right]
(1.48,.8)
(1.43,1.4) to[bend right] (2.1,2.5);
\node[red, circle, draw, text width=10pt] at (.1,.85) {};
\node[blue, circle, draw, text width=10pt] at (1.43,1.4) {};
\end{tikzpicture}}

\begin{document}
Without \verb|[blank=soft]| on has one path, and the arrow heads are in the
beginning and at the end of the path:

\jdx

Standard Ti\emph{k}Z behavior: whenever there is a gap in the path, the arrow
heads are attached at the last stretch.

\standardz

The Hobby paths do not behave differently. If you want to add a round line cap
at the beginning, you may just use decorations, which affect the whole path.

\gapdx

\end{document}