2

I have the following minimal example where I use in and out in combination with shorten >:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.style = {draw, circle, minimum size = 1.5em}]
\node (a) at (0, 0) {$a$};
\node (b) at (0, 0.8) {$b$};
\draw[->, shorten > = 3pt] (a) to [out = 45, in = -45] (b);
\end{tikzpicture}
\end{document}

Arrowhead angle is wrong

As you can see, the arrowhead is no longer aligned with the end of the path. Is there a way to change either the angle of the arrowhead, or — ideally — the curvature of the path, such that it comes in at a -45 degree angle at the point 3pt before the node? I would not mind tweaking some angles or control points manually.

This question is the closest question I could find, but it relates to the decorations library which I am not using.

  • Consider moving b a little bit upper. Maybe at position (0,1). – Sigur Mar 5 '18 at 14:07
  • Unfortunately moving the nodes is not an option for me. – Ruud Mar 5 '18 at 14:08
  • Even by 0.2 only? – Sigur Mar 5 '18 at 14:09
3
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, % <--- added
                bending      % <--- added
                }

\begin{document}
\begin{tikzpicture}[every node/.style = {draw, circle, minimum size = 1.5em}]
\node (a) at (0, 0) {$a$};
\node (b) at (0, 0.8) {$b$};
\draw[-{Straight Barb[bend]}, % <--- changed 
      shorten > = 3pt] (a) to [out = 45, in = -45] (b);
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Perfect, thanks! In my not-so-minimal use case I am using a custom arrow tip to match tikz-cd, but setting bend on that arrow tip did the trick. – Ruud Mar 5 '18 at 14:16
1

Despite the fact that Zarko's answer is already good, I would like to bring to your attention a different approach that could be or not a possible alternative for you. Using the looseness key (described in section 70.3 of the pgf manual), it is possible to act on the distance of the control points from the start and target coordinates.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[every node/.style = {draw, circle, minimum size = 1.5em}]
      \node (a) at (0, 0) {$a$};
      \node (b) at (0, 0.8) {$b$};
      \draw[->, shorten > = 3pt] (a) to [out = 45, in = -45, looseness=1.6] (b);
    \end{tikzpicture}
\end{document}

Maybe you could use this in combination with bending the arrow head.

enter image description here

| improve this answer | |

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.