smartdiagram 表格内部添加节点

smartdiagram 表格内部添加节点

我有以下图表,使用 tikz smartdiagram 创建。如您所见,可以在普通块内添加表格。但是是否可以在附加节点内添加与现有表格类似的表格?如果不行,有人知道如何创建这样的图表吗?

图表

\documentclass[12pt,a4paper,halfparskip,headsepline,twoside]{report}
\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}
\usepackage[ngerman]{babel}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usetikzlibrary{mindmap,arrows}
\usepackage{float}
\usepackage{color}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\usepackage{graphicx}
\usepackage{caption}

\begin{document}



\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}
\begin{figure}[H]
    \vspace{40mm}\par
    \begin{center}
        \smartdiagramset{%
            back arrow disabled=true,
            module minimum width=4cm,
            module minimum height=4cm,
            module x sep=5cm,
            text width=4cm,
            arrow style=<-,
            additions={
                additional item offset=1cm,
                additional item fill color=colours!!+!20,
                additional item border color=colours!!,
                additional arrow color=red,
                additional item width=4cm,
                additional item height=4cm,
                additional item text width=4cm,
                additional item bottom color=red!50,
                additional item shadow=drop shadow,
            }
        }
        \smartdiagramadd[flow diagram:horizontal]{
            accelerometer
            \begin{tabular}{ll}
                Name & Unit\\ \hline
                accelerationX & g\\
                accelerationY & g\\
                accelerationZ & g\\ 
            \end{tabular}, Block
        }{below of module2/Output,right of module2/gyroscope, above of module2/magnetometer
    }
    \smartdiagramconnect{->}{module2/additional-module1}        \smartdiagramconnect{->}{additional-module2/module2}
    \smartdiagramconnect{->}{additional-module3/module2}
\end{center}
\vspace{50mm}\par
\label{tab:gyroMeanOffsetCorrectionSchema}
\captionsetup{justification=centering}
\captionof{figure}{gyroMeanOffsetCorrection Schema}
\end{figure}

\end{document}

当我将表格添加到附加节点时收到的错误是: \@xs@StrCut@@ 的使用与其定义不匹配。 }

答案1

如果您先将表格保存在框中,它就可以正常工作。使问题中的代码更加简洁,例如,通过删除一些不相关的内容:

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usetikzlibrary{mindmap,arrows}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}

\begin{document}
\definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\resetcolorseries[12]{colours}
\smartdiagramset{%
  back arrow disabled=true,
  module minimum width=4cm,
  module minimum height=4cm,
  module x sep=5cm,
  text width=4cm,
  arrow style=<-,
  additions={
    additional item offset=1cm,
    additional item fill color=colours!!+!20,
    additional item border color=colours!!,
    additional arrow color=red,
    additional item width=4cm,
    additional item height=4cm,
    additional item text width=4cm,
    additional item bottom color=red!50,
    additional item shadow=drop shadow,
  }
}
\vspace*{50mm}
\newsavebox\outputbox
\sbox\outputbox{%
  \begin{tabular}{ll}
    Name & Unit\\ \hline
    accelerationX & g\\
    accelerationY & g\\
    accelerationZ & g\\
  \end{tabular}%
}
\smartdiagramadd[flow diagram:horizontal]{
  accelerometer
  \begin{tabular}{ll}
    Name & Unit\\ \hline
    accelerationX & g\\
    accelerationY & g\\
    accelerationZ & g\\
  \end{tabular}, Block
}{%
  below of module2/Output \usebox\outputbox,
  right of module2/gyroscope, above of module2/magnetometer
}
\smartdiagramconnect{->}{module2/additional-module1}        \smartdiagramconnect{->}{additional-module2/module2}
\smartdiagramconnect{->}{additional-module3/module2}
\end{document}

已将表格另存为

无关:

  • \label必须来 \caption

  • \captionof仅在相关浮点类型之外才是必需的。在figure环境中,使用\caption

  • 不要加载不需要的包;不要加载多余的包;不要加载具有不同选项的包。color可以去。也可以graphicx

  • 不要使用H说明符 for figure。它会产生问题,99% 的情况下最好避免使用。

  • 在等\centering内部figure和外部环境中使用。tablecenter

  • halfparskip,headsepline对于此类来说不是有效的选项。

  • a4paper当使用不带的标准类时会产生奇怪的结果geometry

相关内容