4

I have the following diagram, created with tikz smartdiagram. As you can see, it's possible to add a tabular inside a normal block. But is it possible to add a tabular, similar the existing one, inside an additional node? If not, has someone an idea how to create a diagramm like that?

diagram

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

the error I get when I add a tabular to an additional node is: Use of \@xs@StrCut@@ doesn't match its definition. }

  • Welcome to TeX.SE!. Your MWE works and gives showed result. I can not reproduce mentioned error. – Zarko Jul 31 '16 at 20:59
  • If there is a problem, it is due to smartdiagram package (which appears to be more work than doing without). The contents of TikZ nodes should be independent or one another. – John Kormylo Jul 31 '16 at 21:12
  • Have you tried saving the tabular in a box first? – cfr Jul 31 '16 at 21:18
3

It works fine if you save the tabular in a box first. Making the code in the question a bit more minimal, for example, by removing some of the irrelevancies:

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

saved tabular as addition

Off-topic:

  • \label must come after \caption.

  • \captionof is only required outside the relevant float kind. Within a figure environment, use \caption.

  • Don't load packages you don't need; don't load redundant packages; don't load packages with different options. color can go. So can graphicx.

  • Don't use the H specifier for figure. It is problematic and should better be avoided in 99% of cases.

  • Use \centering within figure, table etc. and the center environment outside.

  • halfparskip,headsepline are not valid options for this class.

  • a4paper will give strange results when using a standard class without geometry.

| improve this answer | |
  • thanks a lot for your answer, it worked fine! I try to observe you off-topic notes. Thanks a lot for them too. – lukas Aug 1 '16 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.