TikZ 图上的奇怪缺陷

TikZ 图上的奇怪缺陷

我在论文答辩的一张 Beamer 幻灯片上构建了一个 TikZ 图表,表示我的研究软件的工作流程。它运行良好,但有一个例外:“ready4EDA”块的东侧有一个“缺陷”(额外的箭头末端提示 + 错误的箭头起始提示)。这对我来说似乎很奇怪,并且基于其他块定义代码的相似性,我甚至怀疑它可能是软件缺陷(可能性不大)或 LaTeX 或 TikZ 包之间的冲突。我希望得到评论,最好是解决该“缺陷”的解决方案。MWE 如下。

在此处输入图片描述

笔记:1)我想继续使用这个(标准 TikZ)实现;2)我smartdiagram在演示文稿中使用该包来制作其他一些图表。

\documentclass[12pt]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{mindmap, trees, shadows, shapes, backgrounds, calc, fadings, positioning, decorations.pathreplacing, intersections, fit}
\usepackage{smartdiagram}

\usepackage{palatino}

\usetheme{Boadilla}
\usecolortheme{orchid}
\useinnertheme{rectangles}
\beamertemplateshadingbackground{gray!5}{gray!20}
\setbeamertemplate{navigation symbols}{}


\newcommand{\DISSflossWorkflow}{

  \begin{tikzpicture}[node distance=8cm, auto, >=stealth]

  \tikzstyle{block}= [rectangle, ultra thick, rounded corners, draw=blue, fill=blue!20, minimum height=1.25cm, minimum width=32mm, align=center, inner sep=0.5em]
  \tikzstyle{arrow}= [ultra thick, ->, >=stealth]

  \node[block] (dataHeader) {\color{red}\textbf{Data}};
  \node[block] (softHeader) [right of = dataHeader, node distance = 4cm] {\color{red}\textbf{Software}};
  %\draw[->] (a) -- (b);
  \node[block] (artiHeader) [right of = softHeader, node distance = 4cm] {\color{red}\textbf{Artifacts}};
  %\draw[->] (b) -- (c);
  % \draw[-] (\xcoord[west]{dataHeader}, \ycoord[south]{dataHeader} - 1) -- (\xcoord[east]{artiHeader}, \ycoord[south]{dataHeader} - 1);
  \node[block] (dataSources) [below of = dataHeader, node distance = 1.5cm]{Data Sources};
  \node[block] (softImport) [right of = dataSources, node distance = 4cm] {import};
  \draw[arrow] (dataSources) -- (softImport);

  \node[block] (dataCache) [below of = dataSources, node distance = 1.5cm] {cache};
  \draw[arrow] (softImport) -- (dataCache);

  \node[block] (softPrepare) [right of = dataCache, node distance = 4cm] {prepare};
  \draw[arrow] (dataCache) -- (softPrepare);

  \node[block] (dataTransform) [below of = dataCache, node distance = 1.5cm] {transform};
  \draw[arrow] (softPrepare) -- (dataTransform);

  \node[block] (dataReady4EDA) [below of = dataCache, node distance = 1.5cm] {ready4EDA};
  \draw[arrow] (dataTransform) -- (dataReady4EDA);

  \node[block] (softEDA) [right of = dataReady4EDA, node distance = 4cm] {EDA};
  \draw[arrow] (dataReady4EDA) -- (softEDA);

  \node[block] (artiEDA) [right of = softEDA, node distance = 4cm] {EDA Report};
  \draw[arrow] (softEDA) -- (artiEDA);

  \node[block] (dataReady4EFA) [below of = dataReady4EDA, node distance = 1.5cm] {ready4EFA};
  \draw[arrow] (softEDA) -- (dataReady4EFA);

  \node[block] (softEFA) [right of = dataReady4EFA, node distance = 4cm] {EFA};
  \draw[arrow] (dataReady4EFA) -- (softEFA);

  \node[block] (artiEFA) [right of = softEFA, node distance = 4cm] {EFA Report};
  \draw[arrow] (softEFA) -- (artiEFA);

  \node[block] (dataReady4CFA) [below of = dataReady4EFA, node distance = 1.5cm] {ready4CFA};
  \draw[arrow] (softEFA) -- (dataReady4CFA);

  \node[block] (softCFA) [right of = dataReady4CFA, node distance = 4cm] {CFA};
  \draw[arrow] (dataReady4CFA) -- (softCFA);

  \node[block] (artiCFA) [right of = softCFA, node distance = 4cm] {CFA Report};
  \draw[arrow] (softCFA) -- (artiCFA);

  \node[block] (dataReady4SEM) [below of = dataReady4CFA, node distance = 1.5cm] {ready4SEM};
  \draw[arrow] (softCFA) -- (dataReady4SEM);

  \node[block] (softSEM) [right of = dataReady4SEM, node distance = 4cm] {SEM};
  \draw[arrow] (dataReady4SEM) -- (softSEM);

  \node[block] (artiSEM) [right of = softSEM, node distance = 4cm] {SEM Report};
  \draw[arrow] (softSEM) -- (artiSEM);

  \end{tikzpicture}
}


\begin{document}

\begin{frame}{Research Software: Workflow}

\centering
\scalebox{0.7}{\DISSflossWorkflow}

\end{frame}

\end{document}

答案1

将我的评论转换成答案:

节点dataReady4EDAdataTransform都位于相同的位置(below of=dataCache),因此当您尝试

\draw[arrow] (dataTransform) -- (dataReady4EDA); 

你会看到这个错误的箭头无处可去。你可以注释掉该行(或重新定位节点)来纠正这个问题。


其他说明:

  1. 您可以考虑使用 TikZ 的scale选项 或font=\small等而不是\scalebox,那么使用的字体大小将与演示文稿中的其他设计选择一致,而不是某些任意大小。

  2. 对于新文档,最好使用新方法,\tikzset{<name>/.style={<style-defn>}}而不是旧\tikzstyle方法。(参见应该使用 \tikzset 还是 \tikzstyle 来定义 TikZ 样式?

  3. 您加载新的positioning库,但使用旧的语法right of = <node>而不是定位库语法right=of <node>

相关内容