1

I observe that arrows may not end up perfectly staight.

Here I try show a example where I want to draw a straigth arrow starting from N1's west into N2, please note that I slightly shifted N2 to north for this example.

I was able to draw straight line by try and fail doing \draw[thick,-stealth] (n1.east) -- ([yshift=-1.2mm]n2.west);, I kept changing [yshift=-1.2mm]. 1.21, 1.22 ... checking is it straight or not by eye.

Is there any better way to do this that staight arrow will be drawn in between two nodes?

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                shapes.geometric, shapes.multipart
                }
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
        append after command={
            (\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
            line cap=rect,
            shorten >=-2pt,shorten <=-2pt]
            (\tikzlastnode.south east)}},
            N/.style = {draw, thick,
            font=\scriptsize,
            align=left,
        }]
    \node[compute] (n1) {N1};
    \node[N,right=2cm of n1, yshift=1mm] (n2) {N2};
    \draw[thick,-stealth] (n1.east) -- ([yshift=-1.2mm]n2.west);
\end{tikzpicture}
\end{document}

enter image description here

alper
  • 1,389

0 Answers0