Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tikz arrow tip point towards wrong direction

420 views
Skip to first unread message

Oliver Corff

unread,
Mar 31, 2013, 3:07:40 PM3/31/13
to
Hello everybody,

I encountered a strange problem with the following minimal example:


\documentclass{memoir}
\usepackage{xltxtra}
\usepackage{tikz}

\begin{document}
\begin{figure}
\begin{tikzpicture}[thick]
\path
(4,2) node[rectangle,draw,anchor=west] (I) {I: }
(4,1) node[rectangle,draw,anchor=west] (II) {II: Jingyanggong};

\draw (0,1) node[anchor=east] (Huang) {Huang}
(0,3) node[anchor=east] (C) {Chun};

\draw[|->] (Huang) .. controls +(right:1cm) and +(left:1cm) .. (I); % arrow points right, ok
\draw[|->] (Huang) .. controls +(right:1cm) and +(left:1cm) .. (II);% arrow points left [sic!]

\draw[|->] (C) .. controls +(right:1cm) and +(left:1cm) .. (I); % dito
\draw[|->] (C) .. controls +(right:1cm) and +(left:1cm) .. (II);% dito

\end{tikzpicture}
\caption{Die Textquellen des FÃ?nfsprachenspiegels}
\end{figure}
\end{document}

If the node I ("I: ") is filled with text to the length of node II, then
the arrow will point leftwards, too.

What can I do to anchor the tip correctly (it overshoots the second box,
btw)?

Thank you for any suggestions,
Oliver.

--
Dr. Oliver Corff e-mail: co...@zedat.fu-berlin.de

Marc van Dongen

unread,
Apr 1, 2013, 4:38:58 AM4/1/13
to
On Sunday, March 31, 2013 8:07:40 PM UTC+1, Oliver Corff wrote:

> I encountered a strange problem with the following minimal example:

I am not sure if it's strange.

> \draw[|->] (Huang) .. controls +(right:1cm) and +(left:1cm) .. (I); % arrow points right, ok
>
> \draw[|->] (Huang) .. controls +(right:1cm) and +(left:1cm) .. (II);% arrow points left [sic!]

The first point of the _curveto_ operation and both control
points are on the same line. This second control point is
to the left of all these points. I think you will find the
line segment will make a very sharp bend just to the right
of the end point.

The "direction" of the line at the end point should in the
same direction as the line segment from the end point to
the second control point. The arrow head seems to point in
that same direction, so Ithink it's probably correct.

Regards,


Marc van Dongen

Marc van Dongen

unread,
Apr 1, 2013, 5:09:35 AM4/1/13
to
On Monday, April 1, 2013 9:38:58 AM UTC+1, Marc van Dongen wrote:

> [ snip ]

I had one more look.

You don't get the sharp bend I was talking about if you use the
centres of the shapes as the control and end points. The curves
in the example should be the parts of the curves that are outside
the node shapes.

It looks as if TikZ is trying to approximate the part of the spline
that's outside the coordinate shapes and makes some rounding or
calculation error. You can temporarily solve your problem by writing
(node.west), where node is the label of the node shape.

Regards,


Marc van Dongen

Oliver Corff

unread,
Apr 2, 2013, 4:04:24 PM4/2/13
to
Hi Marc,

Thank you for the insight!

Marc van Dongen <don...@cs.ucc.ie> wrote:
I found out that the length of the text at a given node is crucial.
With a short text, the arrow tip is presented correctly, with a long
text, the border is pushed so far away that TikZ is tricked into
turning back.

I later found a useful solution, completely bypassing the original
setup.

Thank you a lot,
0 new messages