2

I like the Stealth[round,bend] arrow tips, and recently discovered that they do not work as I expect when the line curved and doubled. Playing with a small example, I found out that the bend parameter is not the problem, the problem is simply caused by loading the bending library.

Here is a small example that does not load the bending library:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
%\usetikzlibrary{bending}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[>={Stealth[round]}]
  \node[draw] (A) at (0,0) {A};
  \node[draw] (B) at (2,0) {B};
  \draw[->]        (A) to[bend right] (B);
  \draw[->,double] (A) to[bend left] (B);
  \draw[->,double] (A) to (B);
  \draw[->,double] (A) to[loop above] (A);
\end{tikzpicture}
\end{document}

nice looking result

Now if I uncomment the \usetickzlibrary{bending}, then the figure now gets rendered as follows.

bad looking result

Does anyone know a workaround to fix that? Ideally I would like to use >={Stealth[round,bend]} so loading \usetickzlibrary{bending} seems necessary.

4
  • 1
    This post is almost identical to this question. Such a behavior is a bug, that has already been reported. Currently, you can fix it with this workaround.
    – antshar
    Sep 22 at 13:30
  • 3
    The TikZ library bending not only loads the bending module (which doesn't do much at all unless you use one of its option) but it sets arrows=[flex] which activates part of its working. You could do \tikzset{double/.append style={arrows={[quick]}}} to disable this again but then you need to define two different Stealth tips, one with bend (for non-doubled lines) and one without bend (or flex) for doubled and curved lines. But then you could just define StealthDouble/.tip={Stealth[round,quick]}. Sep 22 at 13:49
  • 1
    Do you want a workaround that does support bend with curved doubled lines (then the bug needs to be fixed) or do you want to use the bending at least with non-doubled or non-curved lines? Sep 22 at 13:50
  • I'm using bended arrows everywhere while drawing automata, but I'm only using doubled lines in a couple of places. So disabling bending locally for double lines would be ok-ish as a workaround. I'll try your quick trick, this sounds promising.
    – adl
    Sep 23 at 13:23

1 Answer 1

1

Using Qrrbrbirlbel's tip about using quick to disable the flex computation that is broken for double line, I'm now using the following workaround to have bent arrows everywhere except when I need a double line.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[>={Stealth[round,bend,length=4.75pt]},
                    % disable flex on double lines due to
                    % https://github.com/pgf-tikz/pgf/issues/896
                    StealthDouble/.tip={Stealth[round,quick,length=4.75pt]},
                    double>/.style={-StealthDouble,double}]
  \node[draw] (A) at (0,0) {A};
  \node[draw] (B) at (2,0) {B};
  \draw[->]      (A) to[bend right] (B);
  \draw[double>] (A) to[bend left] (B);
  \draw[double>] (A) to (B);
  \draw[double>] (A) to[loop above] (A);
  \draw[->] (B) to[loop above] (B);
\end{tikzpicture}
\end{document}

workaround

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.