5

I'm trying to break a line in two places, to achieve something like this:

enter image description here

The example has rounded breaks but that's the idea. I have the following code, which generates only one break:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{automata,positioning,arrows,arrows.meta,shapes,decorations.pathreplacing,fit,calc}
\usetikzlibrary{automata,positioning,arrows,shapes,decorations.pathreplacing,fit,calc}
\usetikzlibrary{angles,quotes}
\usetikzlibrary{decorations.pathreplacing,calc}  

\begin{document}

% Define block styles
\tikzstyle{decision} = [diamond, draw,  
    text width=4.8em, text centered, node distance=2cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw,  
    text width=7em, text centered, rounded corners, minimum height=2em]
\tikzstyle{arrow} = [draw, -latex']
\tikzstyle{line} = [draw]
\tikzstyle{invisible4} = [rectangle]
\tikzstyle{invisible5} = [rectangle]
\tikzstyle{circular} = [draw, circle, radius=1.0cm,]

\begin{figure}[h]
    \centering
    \begin{tikzpicture}[node distance = 2cm, auto, scale=1.0]
        \node [block] (pulse) {\small P};
        \node [invisible4, below of=pulse] (aux2) {};
        \node [block, left of=aux2] (fp) {\small FP};
        \node [block, right of=aux2] (rp) {\small FP};
        \node [circular, below of=aux2] (minus) {\small -};
        \node [decision, below of=minus] (threshold) {\small $\le T$ ?};
        \node [invisible4, below of=threshold] (aux3) {};
        \node [block, left of=aux3] (fp2) {\small FP};
        \node [block, right of=aux3] (rp2) {\small RP};
        \node [invisible4, below of=aux3, node distance=1.0cm] (aux) {};
        \node [invisible5, draw=none, below of=aux, node distance=1.0cm] (aux4) {};

        \path [arrow] (pulse) |- (fp);
        \path [arrow] (pulse) |- (rp);
        \path [arrow] (fp) |- (minus);
        \path [arrow] (rp) |- (minus);
        \path [arrow] (minus) -- (threshold);
        \path [arrow] (threshold) -| node [above, near start] {yes} (fp2);
        \path [arrow] (threshold) -| node [near start] {no} (rp2);
        \path [line] (fp2) |- (aux);
        \path [line] (rp2) |- (aux);

    \end{tikzpicture}
\end{figure}

\end{document}

This code generates this figure:

enter image description here

I was trying to create the two breaks in the arrows connecting P and FP, P and RP, and an arrow from the bottom FP and RP connecting and pointing below. I've tried to create an auxiliary invisible node between, but this node still occupies space (which can be seen in the image, the gap between the lines).

How can I break these lines?

Thank you!

6

Choose a point in the middle and 'break' again. Use rounded corners option if you don't want the sharp corners.

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,calc,arrows}

\begin{document}
% Define block styles
\tikzstyle{decision} = [diamond, draw,  
    text width=4.8em, text centered, node distance=2cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw,  
    text width=7em, text centered, rounded corners, minimum height=2em]
\tikzstyle{arrow} = [draw, -latex',rounded corners]
\tikzstyle{line} = [draw]
\tikzstyle{invisible4} = [rectangle]
\tikzstyle{invisible5} = [rectangle]
\tikzstyle{circular} = [draw, circle, radius=1.0cm,]

\begin{figure}[h]
    \centering
    \begin{tikzpicture}[node distance = 2cm, auto, scale=1.0]
        \node [block] (pulse) {\small P};
        \node [invisible4, below of=pulse] (aux2) {};
        \node [block, left of=aux2] (fp) {\small FP};
        \node [block, right of=aux2] (rp) {\small FP};
        \node [circular, below of=aux2] (minus) {\small -};
        \node [decision, below of=minus] (threshold) {\small $\le T$ ?};
        \node [invisible4, below of=threshold] (aux3) {};
        \node [block, left of=aux3] (fp2) {\small FP};
        \node [block, right of=aux3] (rp2) {\small RP};
        \node [invisible4, below of=aux3, node distance=1.0cm] (aux) {};
        \node [invisible5, draw=none, below of=aux, node distance=1.0cm] (aux4) {};

        \path [arrow] (pulse) |- ($(pulse)+(0,-1)$) -| (fp);
        \path [arrow] (pulse) |- ($(pulse)+(0,-1)$) -|  (rp);
        \path [arrow] (fp) |- (minus);
        \path [arrow] (rp) |- (minus);
        \path [arrow] (minus) -- (threshold);
        \path [arrow] (threshold) -| node [above, near start] {yes} (fp2);
        \path [arrow] (threshold) -| node [near start] {no} (rp2);
        \path [line] (fp2) |- (aux);
        \path [line] (rp2) |- (aux);

    \end{tikzpicture}
\end{figure}

\end{document}
4
  • That's literally the code I posted... Am I missing something?
    – Hel
    Nov 26 '18 at 9:10
  • @Hel. See the line where paths are drawn from (pulse) to (fp) and (rp)
    – nidhin
    Nov 26 '18 at 9:12
  • @Hel. Also removed few tikz libraries which are needed for this code to run.
    – nidhin
    Nov 26 '18 at 9:19
  • thank you! I must be blind, I was looking at the bottom arrow and didn't even notice the top one. Thank you so much, that's exactly what I wanted. I've managed to fix the other as well. I copied them from the original doc, which has a lot of images, they're necessary for the others. Thank you again!
    – Hel
    Nov 26 '18 at 9:28

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.