4

Let's say I have a smart diagram like follows:

\documentclass{article}
\usepackage{smartdiagram}
\usepackage{tikz}
\usesmartdiagramlibrary{additions}
\begin{document}
\begin{center}
  \smartdiagramset{border color=none, uniform color list=teal!60 for 5 items, arrow style=<-, module x sep=3.25, back arrow disabled,}
  \smartdiagram[flow diagram:horizontal]{A, B, C, D, E}
  \smartdiagramconnect{->}{module3/module2}
\end{center}
\end{document}

I want to have two "back arrows": from element E to element D, and from element C to element B. However, the back arrow (which I have set to be false in the MWE) is only between the last module and the first, and I can't find in the documentation how to link two other modules.

2
  • Welcome to TeX.SX!
    – diabonas
    Sep 14, 2017 at 13:39
  • 1
    You may find it easier to do what you need in TikZ as smartdiagram is less flexible by design.
    – cfr
    Sep 14, 2017 at 13:59

1 Answer 1

5

If you want to use \smartdiagramconnect, you need to use \smartdiagramadd (with requires a second mandatory argument that you can leave empty) instead of \smartdiagram. This allows TikZ remembers the node names that you can then use later with \smartdiagramconnect.

Unfortunately, \smartdiagramconnect is not very useful for your use case, at it only allows to draw straight connections, which would overlay your previously drawn forward arrows. Instead you can use some custom TikZ code to draw the missing connections manually:

\documentclass{article}
\usepackage{smartdiagram}
\usepackage{tikz}
\usesmartdiagramlibrary{additions}
\begin{document}
\begin{center}
\smartdiagramset{border color=none, uniform color list=teal!60 for 5 items, arrow style=<-, module x sep=3.25, back arrow disabled,}
\smartdiagramadd[flow diagram:horizontal]{A, B, C, D, E}{}
\begin{tikzpicture}[overlay]
\draw[additional item arrow type,color=teal!60] (module5) -- ++(0,1) -| (module4);
\draw[additional item arrow type,color=teal!60] (module3) -- ++(0,1) -| (module2);
\end{tikzpicture}
\end{center}
\end{document}

resulting diagram with back arrows

2
  • You can also use \tikzstyle{every picture}+=[remember picture] and then the regular \smartdiagram (which is what \smartdiagramadd does)
    – Marijn
    Sep 14, 2017 at 14:36
  • @Marijn You are right, it does. Actually, I would advise against doing something like this, because using remember picture for all TikZ pictures leads to some unnecessary overhead as all nodes need to be stored instead of only the necessary ones (but as you noted, \usediagramadd does the same, so there is no way around short of messing around with smartdiagram internals). Well, at least the effect is limited to the current group, so for the example it is fine as it contained in a center environment.
    – diabonas
    Sep 14, 2017 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .