在 tikz 環境中加入加號

在 tikz 環境中加入加號

我正在製作流程圖。

目前,我有:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows,amsmath}

\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

\tikzstyle{arrow}=[thick,->,>=stealth]

    \begin{document}

    \begin{tikzpicture}[node distance=2cm]
        \node (start) [process] {
        $\text{A}_{it}$
        };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right of=in1, xshift=2cm] {$\text{ D}_{it}$};
        \draw [arrow] (start)--(pro2);
        \draw [arrow] (in1)--(pro2);
        \draw [arrow] (in2)--(pro2);
    \end{tikzpicture}
    \end{document}

這將三個節點 A、B、C 到 D 連接起來。

現在,我希望在 D 的右側建立另一個節點 E,但我想添加加號而不是箭頭。

有什麼辦法可以做到這一點嗎?

答案1

像這樣 ?

螢幕截圖

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz,amsmath}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning}

\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

\tikzstyle{arrow}=[thick,->,>=stealth]

    \begin{document}

    \begin{tikzpicture}[node distance=2cm]
        \node (start) [process] {
        $\text{A}_{it}$
        };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right= 2cm of in1] {$\text{ D}_{it}$};
        \node (pro3) [decision, right= 2cm of pro2] {$\text{ E}_{it}$};
        \draw [arrow] (start)--(pro2);
        \draw [arrow] (in1)--(pro2);
        \draw [arrow] (in2)--(pro2);
        \draw (pro2) edge node[draw,fill=white,circle]{+} (pro3);
    \end{tikzpicture}
    \end{document}

附錄

\tikzstyle自 tikz 2.10 版本以來已被棄用,您必須使用\tikzset which Give :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz,amsmath}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning}

%\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
%\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
%
%\tikzstyle{arrow}=[thick,->,>=stealth]

\tikzset{
    process/.style={rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30},
    decision/.style={diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
        }
    \begin{document}

    \begin{tikzpicture}[node distance=2cm,arrows={-stealth},thick]
        \node (start) [process] { $\text{A}_{it}$ };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right= 2cm of in1] {$\text{ D}_{it}$};
        \node (pro3) [decision, right= 2cm of pro2] {$\text{ E}_{it}$};
        \draw [->] (start)--(pro2);
        \draw [->] (in1)--(pro2);
        \draw [->] (in2)--(pro2);
        \draw (pro2) edge node[fill=white]{+} (pro3);
    \end{tikzpicture}
    \end{document}

相關內容