2

Here is my code, I want connect A and C without B. How can I change? Thank you so much!

\documentclass[tikz,
               border=5mm]{standalone}
\usetikzlibrary{arrows, chains, positioning, quotes, shapes.geometric}
\usepackage[utf8]{inputenc}
\usepackage{braket}
\usepackage{url}
\usepackage{chemarrow}
\newcommand{\lra}{\ensuremath{\mathrel{%
    \mkern1.5mu\textrm{\arro\symbol{71}}%
    \mkern-1.1mu\textrm{\arro\symbol{65}}%
    }}\xspace}
\usepackage{xspace}

\begin{document}
    \begin{tikzpicture}[
    node distance = 8mm and 20mm,
      start chain = going below,
     arrow/.style = {thick,-stealth},
      base/.style = {
            draw, thick, 
            minimum width=30mm, minimum height=10mm, align=center,
            inner sep=1mm, outer sep=0mm,
            on chain, join=by arrow},
  decision/.style = {diamond, base,
            aspect=1.5, inner xsep=0mm},
   process/.style = {rectangle, base},
 startstop/.style = {rectangle, rounded corners, base},
                        ]
\node (start)   [startstop] {Start};
\node (setup)   [process]   {Input a specific $n$ };

\node (test)    [decision]  {is 5?};
\node (acqir)   [process,left=of test]    {A};
\node (compute) [process]   {B};
\node (displace)[process]   {C};
\draw [arrow] (test) |- node [near start,right] {Yes} (compute);
\path   (test) to["No"] (acqir);
\node (end)     [process]   {End};

    \end{tikzpicture}
\end{document}
AML
  • 2,265
Goat
  • 31

1 Answers1

1

Adding \draw [arrow] (acqir.west) -| ([xshift=-10mm]compute.west) |- (displace.west); would add an arrow that connects A and C (I removed some unused options and packages):

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{chains, quotes, shapes.geometric}
\usepackage[utf8]{inputenc}


\begin{document}
    \begin{tikzpicture}[
    node distance = 8mm and 20mm,
      start chain = going below,
     arrow/.style = {thick,-stealth},
      base/.style = {
            draw, thick, 
            minimum width=30mm, minimum height=10mm, align=center,
            inner sep=1mm, outer sep=0mm,
            on chain, join=by arrow},
  decision/.style = {diamond, base,
            aspect=1.5, inner xsep=0mm},
   process/.style = {rectangle, base},
 startstop/.style = {rectangle, rounded corners, base},
                        ]
\node (start)   [startstop] {Start};
\node (setup)   [process]   {Input a specific $n$ };

\node (test)    [decision]  {is 5?};
\node (acqir)   [process,left=of test]    {A};
\node (compute) [process]   {B};
\node (displace)[process]   {C};
\draw [arrow] (test) |- node [near start,right] {Yes} (compute);
\path   (test) to["No"] (acqir);
\node (end)     [process]   {End};

\draw [arrow] (acqir.west) -| ([xshift=-10mm]compute.west) |- (displace.west);

    \end{tikzpicture}
\end{document}

enter image description here


Edit

If you don’t want to join A and B or B and C (see also these answers):

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{chains, quotes, shapes.geometric}
\usepackage[utf8]{inputenc}

\makeatletter
\tikzset{
  suppress join/.code={\def\tikz@after@path{}}
}
\makeatother
\begin{document}
    \begin{tikzpicture}[
    node distance = 8mm and 20mm,
      start chain = going below,
     arrow/.style = {thick,-stealth},
      base/.style = {
            draw, thick, 
            minimum width=30mm, minimum height=10mm, align=center,
            inner sep=1mm, outer sep=0mm,
            on chain, join=by arrow},
  decision/.style = {diamond, base,
            aspect=1.5, inner xsep=0mm},
   process/.style = {rectangle, base},
 startstop/.style = {rectangle, rounded corners, base},
                        ]
\node (start)   [startstop] {Start};
\node (setup)   [process]   {Input a specific $n$ };

\node (test)    [decision]  {is 5?};
\node (acqir)   [process,left=of test]    {A};
\node (compute) [process,suppress join]   {B};
\node (displace)[process,suppress join]   {C};
\draw [arrow] (test) |- node [near start,right] {Yes} (compute);
\path   (test) to["No"] (acqir);
\node (end)     [process]   {End};

\draw [arrow] (acqir.west) -| ([xshift=-10mm]compute.west) |- (displace.west);

    \end{tikzpicture}
\end{document}

enter image description here