TikZ - 所有钻石形状中心的黑点/钻石

TikZ - 所有钻石形状中心的黑点/钻石

我正在制作流程图,在独立的 TikZ 文件中一切看起来都很好,但当我将其用于\input我的论文时,所有菱形在形状的正中央都有一个小黑菱形。无论节点中是否有文本,都会发生这种情况。由于我的论文模板,很难包含一个工作示例,但其他一切看起来都一样。

知道是什么原因造成中心出现这些小钻石吗?

\usetikzlibrary{shapes.misc,arrows, positioning}

\tikzstyle{startstop} = [draw, rectangle, rounded corners, top color=white, bottom color=red!30]
\tikzstyle{process} = [draw, rectangle, align=center, top color=white, bottom color=blue!30]
\tikzstyle{decision} = [draw, diamond, aspect=2, align=center, top color=white, bottom color=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}

\node (start) [startstop] {start};
\node (plf) [below=of start, process] {text \\ text};
\node (3) [below=of plf, decision] {text \\ $||$ \\ text};
\node (4) [below=of 3, process] {text $\pm$ 1};
\node (5) [below=of 4, process] {text \\ text};
\node (6) [below=of 5, process] {text \\ text};
\node (7) [below=of 6, process] {text};
\node (empty1) [right=of 3] {};
\node (9) [right=of empty1, decision] {text \\ text};
\node (10) [below=of 9, process] {text \\ text};
\node (stop) [below=of 10, startstop] {stop};

\node[coordinate] (12) [left=of 3] {};
\node[coordinate] (13) [right=of 9] {};

\draw [arrow] (start) -- (plf);
\draw [arrow] (plf) -- (3);
\draw [arrow] (3) -- node[anchor=west] {no} (4);
\draw [arrow] (4) -- (5);
\draw [arrow] (5) -- (6);
\draw [arrow] (6) -- (7);
\draw [arrow] (7) -| (12) --  (3);
\draw [arrow] (3) -- node[anchor=south] {yes} (9);
\draw [arrow] (9) --  node[anchor=west] {no}(10);
\draw [arrow] (9) -- node[anchor=south] {yes} (13) |- (stop);
\draw [arrow] (10) -- (stop);

\end{tikzpicture}

答案1

您的问题的原因已在上面的评论中发现并描述萨姆卡特成本加运费(感谢两位!)。此问题的临时解决方案可以是:

  1. 按照建议成本加运费在她的评论中
  2. 使用现有的 MWE 生成 pdf 文件,然后将其作为图像包含在您的文档中:\includegraphics{<flowchart name>}
  3. 而是diamond使用不同的形状,例如signal与它有相似之处

对于最后一种可能性,MWE 可以是:

\documentclass[tikz,
               border=3mm]{standalone}
\usepackage{circuitikz}% <-- makes trouble before
\usetikzlibrary{arrows, chains, quotes, positioning, 
                shapes.symbols}

\begin{document}
    \begin{tikzpicture}[
    node distance = 6mm and 12mm,
      start chain = going below,% <-- new
      base/.style = {draw, minimum width=4.5em, align=flush center, outer sep=0pt,
                     on chain},% <-- new
  decision/.style = {shape=signal, base,% <-- new, replace diamond
                     signal to=west and east,
                     top color=white, bottom color=green!30},
   process/.style = {shape=rectangle, base,
                     top color=white, bottom color=blue!30},
 startstop/.style = {shape=rectangle, base,
                     rounded corners,
                     top color=white, bottom color=red!30},
     arrow/.style = {thick, -stealth},
every join/.style = {arrow}
                        ]
% left column 
\node (start)   [startstop] {start};
\node (plf)     [process,join]   {text \\ text};
\node (3)       [decision,join]  {text \\ $||$ \\ text};
\node (4)       [process]   {text $\pm$ 1};
\node (5)       [process,join]   {text \\ text};
\node (6)       [process,join]   {text \\ text};
\node (7)       [process,join]   {text};
% right column
\node (8)       [decision,right=of 3] {text \\ text};
\node (9)       [process]        {text \\ text};
\node (stop)    [startstop,join] {stop};
% auxiliary coordinates
\coordinate[left =of 3.west] (10);
\coordinate[right=of 8.east] (11);
% connection lines
\draw [arrow]   (3) edge ["no"]   (4) 
                (3) edge ["yes"]  (8)
                (8) edge ["no"]   (9)
                (8)  to  ["yes"]  (11) |- (stop);
\draw [arrow]   (7) -| (10) -- (3);
    \end{tikzpicture}  
\end{document}

在上面的 MWE 中,我还使用了 TikZ 库chainsquotes并通过它们的帮助使代码更简洁。我还将流程图元素样式定义移到了 TikZ 图片选项中。Iz 可以在其他地方定义为 而\tikzset{...}不是 obsolete tikzstyle。使用此代码获得的图像如下。

在此处输入图片描述

相关内容