2

I am currently trying to create the following plot (in nice) using tikz:

enter image description here

This is my first attempt, which is not working as I want:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikzstyle{block} = [draw, rectangle]

\begin{tikzpicture}[auto, node distance=2cm]

    \node [block] (A) {A};
    \node [block, below right=of A] (B) {B};
    \node [block, right= of B] (C) {C};

    \draw [draw,->] (A)-|(B);
    \draw [draw,->] (B)--(C);
    \draw [draw,->] (C)--(B);
\end{tikzpicture}

\end{document}

My first problem is, that I don't know how I can tell tikz, for example for the C->B path, to not use the shortest path, but connect C with B "from the left side". Also, the arrows seem to always connect towards the middle of the blocks, how can I specify a position above or below the middle (as for the B or C blocks)?

Finally, how can I connect from a line directly to a block (the third input of B) with marking the line there with a black dot?

I have looked at some tutorials for node placement, but the above topics were not addressed unfortunatly...

2

I am sure that there are shorter versions. Yet this code may be easier to understand. The strategy is to add several auxiliary coordinates H1, H2 etc. and use those for the path construction.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikzset{block/.style = {draw, rectangle},
Connect/.style={-latex,thick}}

\begin{tikzpicture}[auto, node distance=2cm]

    \node [block] (A) {A};
    \node [block, below right=of A] (B) {B};
    \node [block, right= of B] (C) {C};
    \path (A)--(B) coordinate[midway](H1) coordinate[pos=0.75](H2);
    \coordinate[right=0.5cm of C](H3);
    \coordinate[left=0.5cm of A](H4);
    \coordinate[below=0.5cm of B](H5);
    \path (B)--(C) coordinate[midway](H6);
    \draw [Connect] (A)--(A-|H1)--(B-|H1)--(B);
    \draw [Connect] (B)--(C);
    \draw [Connect] (C.east)--(C-|H3)--(H1-|H3)--(H1-|H2)|-(B.140);
    \draw [Connect] (H4)--(A);
    \draw [Connect] (H5-|H4)--(H5-|H6)|-(C.220);
    \draw[fill] (H5-|H1) circle(0.1);
    \draw[Connect] (H5-|H1)|-(B.220);
\end{tikzpicture}

\end{document}

enter image description here

BTW, \tikzstyle is (said to be) deprecated, I replaced it by \tikzset.

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.