I have difficulty adjusting the starting coordinates of the arrow line inside a TikZ node:
When I try to make the starting vertical coordinate of the last arrow which is beneath the mid point of the node, a bit higher vertically by subtracting 0.1 like so:
\draw[*-{Stealth},very thick] let \p1 = (B.two), \p2 = (B.center) in (\x1+\nodewidth * 0.10, \y2 -0.1) |- (C);
the starting point jumps above the mid point:
I have tinkered with several other options but still I couldn't position the starting points into the mid point of the node.
The code is just a bit long but it's compiled fine.
% compile with lualatex
\documentclass[a4paper,openany,14pt]{extbook}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,chains,positioning,arrows,calc}
\usetikzlibrary{arrows.meta}
\tikzset{*->stealth}
\usetikzlibrary{fit}
\usepackage{xparse}
\makeatletter % get the dimensions of the box (node) which was formed prior
\NewDocumentCommand {\getnodedimen} {O {\nodewidth} O {\nodeheight} m} {
\begin{pgfinterruptboundingbox}
\begin{scope}[local bounding box=bb@temp]
\node[inner sep=0pt, fit=(#3)] {};
\end{scope}
\path ($(bb@temp.north east)-(bb@temp.south west)$);
\end{pgfinterruptboundingbox}
\pgfgetlastxy{#1}{#2} }
\makeatother
\usepackage{fontspec}
\usetikzlibrary{matrix}
\newcommand{\columnratio}{0.62}
\newcommand{\columnseper}{12pt}
\begin{document}
\pgfmathsetlengthmacro{\ourwidth}{\columnratio * \linewidth - \columnseper}
\tikzset{kutu/.style = {rectangle split, rectangle split horizontal,rectangle split parts=2, very thick,draw=black!100, align=center,font=\footnotesize, text width=0.047 * \ourwidth,minimum width=0.040 * \ourwidth, text height=0.023 * \ourwidth,text depth=2.7pt,inner xsep=0.27cm,}} % kutu is the turkish word for "box"
\noindent\begin{tikzpicture}[start chain=1 going right,start chain=2 going right]
\tikzset{every node}=[font=\small\ttfamily]
\node[rectangle, on chain=1,inner xsep=0.05cm,](ORIG){\footnotesize 1511};
\node[kutu,on chain=1,right=0.0cm of ORIG] (A)
{\nodepart[]{one}1111 \nodepart[]{two}};
\node[kutu, on chain=1,right=0.4cm of A,] (B)
{\nodepart[]{one} \nodepart[]{two}};
\node[kutu, on chain=1,right=0.4cm of B] (C)
{\nodepart[]{one}2111 \nodepart[]{two}};
\node[kutu, on chain=2,below=0.8cm of B] (D) at (6.0, -0.5)
{\nodepart[]{one}3422 \nodepart[]{two}};
\getnodedimen{A} % we extract the dimensions of the box we just formed, in order to position
% the starting coordinate of the arrow line. It gives as output the "nodewidth"
\draw[*-{Stealth},very thick] let \p1 = (A.two), \p2 = (A.center) in (\x1+\nodewidth * 0.10, \y2) -- (B);
\draw[*-{Stealth},very thick] let \p1 = (B.one), \p2 = (B.center) in (\x1+\nodewidth * 0.10, \y2) |- (D);
\draw[*-{Stealth},very thick] let \p1 = (B.two), \p2 = (B.center) in (\x1+\nodewidth * 0.10, \y2) |- (C);
\end{tikzpicture}
\end{document}
How to adjust the starting points of the arrow lines precisely so that they are aligned into the mid and center points inside the TikZ node ?
UPDATE After applying this code
\draw[very thick,red,{Circle[length=6pt,sep=-3pt]}-{Stealth}] ($(B.west)!0.25!(B.east)$) |- (D.west);
\draw[very thick,red,{Circle[length=6pt,sep=-3pt]}-{Stealth}] ($(B.two)$) |- (C.west);
upon daleif
's comment, the situation improved greatly:
As such, that comment solves the problem but what is the ($(B.west)!0.25!(B.east)$)
notation exactly? It looks like the math notation of TeX
but I assume the expression inside $
s does arithmetic / calculates values when used whithin the context of TikZ, is that right?
*-...
arrow, the*
is inside the path instead of from the start. There's probably a setting for this. I'd just use\draw[thick,red] ($(B.west)!0.25!(B.east)$) |- (D.west) ;
(when the dot on the arrow is fixed), IMO much simpler syntax)*
marks an arrowtip
it does what it is suppose to, the dot touches the edge of the arrow. So it does what it is suppose to. I'd just draw the arrow without the dot, then then add the dot afterwards. There might be a setting to move the tip, but I don't know it.\draw[thick,red,{Circle[length=6pt,sep=-3pt]}->] ($(B.west)!0.25!(B.east)$) |- (D.west) ;
, if you know the diameter of the dot, then a negativesep
of half the radius seems to do the trick.(A)!x!(B)
notation is explain in the manual. It makes a new point on the line between(A)
and(B)
. Ifx=0
the point is(A)
, ix-=1
it's(B)
. Additionally if(A)
is a node, it has many extra points, likeA.center
,A.west
,A.north east
etc. All of these can be used in coordinate calculations.