流程图问题

流程图问题

这是我的代码,我想连接 A 和 C,不连接 B。我该如何更改?非常感谢!

\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}

答案1

添加\draw [arrow] (acqir.west) -| ([xshift=-10mm]compute.west) |- (displace.west);将添加一个连接 A 和 C 的箭头(我删除了一些未使用的选项和包):

\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}

在此处输入图片描述


编辑

如果你不想加入 A 和 B 或 B 和 C(请参阅 这些 答案):

\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}

在此处输入图片描述

相关内容