3

I use

\begin{tikzpicture}[
        node distance=4ex and 0em,
        block/.style={rectangle, draw, fill=white!20, 
    text width=7.5em, text centered, rounded corners, minimum height=4em},
        line/.style={draw, -latex},
        ]

        \node [block] (1) {A};
        \node [block, below right= of 1] (2) {B};
        \node [block, below left= of 2] (3) {C};
        \node [block, above left= of 3] (4) {D};

\path [line] (1) -- (2);
\path [line] (2) -- (3);
\path [line] (3) -- (4);
\path [line] (4) -- (1);
    \end{tikzpicture}

I now want to have an arrow (1) to (2), (2) to (3), (4) to (4), and (4) to (1) instead of a line. Please advise.

2
  • You should get an arrow as you are using -latex which implies arrowhead.
    – Imran
    Jan 1, 2022 at 5:46
  • You are right. I did not notice because the arrowhead size was too small in the current drawming. How can one increase the size of the arrowhead? Jan 1, 2022 at 14:23

2 Answers 2

4

With bend left option for edges between nodes, after some manual tweaks (very similar to @CarLaTeX answer, +1) arrows are almost perfectly lie on circle through nodes:

\documentclass[margin=3.141592]{standalone} 
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 4ex and 0em,
 block/.style = {rectangle, draw, fill=white!20,
                 text width=6em, text centered, rounded corners, minimum height=4em},
every edge/.style = {draw=gray, -{Latex[scale=0.8]}, ultra thick, bend angle=20},
                    ]
    \node [block] (1) {A};
    \node [block, below right= of 1] (2) {B};
    \node [block, below left= of 2] (3) {C};
    \node [block, above left= of 3] (4) {D};
\path   (1.east) edge [bend left] (2) 
        (2) edge [bend left] (3.east)
        (3.west) edge [bend left] (4)
        (4) edge [bend left] (1.west);       
    \end{tikzpicture}
\end{document}

gives

enter image description here

10
  • How can one increase the size of the arrowhead? Jan 1, 2022 at 14:23
  • @lemond_2021, actually In my answer I decrease it by Latex[scale=0.8]. Yo can remove [scale=0.8] or even make scale bigger than one, for example by [scale==1.2] However, exist athe possibilities too: defining lenght width` etc. For details see TikZ & PGF manual, Section 16.3.1 Size, page 193.
    – Zarko
    Jan 1, 2022 at 14:37
  • Thank you. But I get "! Package pgfkeys Error: I do not know the key 'scale[' and I am going to ignore it. Perhaps you misspelled it." Jan 1, 2022 at 17:57
  • 1
    @user0193, labels you can add on two ways: (i) as quotes using library oft the same name: \path (1.east) edge [bend left, "some label"] (2);, (ii) using node: \path (1.east) edge [bend left] node {some label} (2);.
    – Zarko
    Aug 17, 2022 at 13:38
  • 1
    @user0193, please ask new question where provide MWE, which reproduce your problem. Sorry, guessing, what you doing, is not my strength . Also my crystal ball refuse to work at current climate condition :-(
    – Zarko
    Aug 19, 2022 at 23:37
6

If my crystal ball is working, I think you want bent arrows instead of straight-line arrows.

You can do it with bend left option:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
    node distance=4ex and 0em,
    block/.style={rectangle, draw, fill=white!20, 
        text width=7.5em, text centered, rounded corners, minimum height=4em},
    line/.style={draw, -latex},
    ]
    \node [block] (1) {A};
    \node [block, below right= of 1] (2) {B};
    \node [block, below left= of 2] (3) {C};
    \node [block, above left= of 3] (4) {D};
    \path [line] (1) to[bend left] (2);
    \path [line] (2) to[bend left] (3);
    \path [line] (3) to[bend left] (4);
    \path [line] (4) to[bend left] (1);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .