7

I am trying to create the following diagram:

enter image description here My current output is:

enter image description here MWE

My MWE is as follows:

\documentclass[a4paper,12pt]{extarticle}
\usepackage{geometry}

\geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=20mm,
 }

\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions} 
\usepackage{tikz}
\usetikzlibrary{arrows} 
\begin{document}

\bigbreak
\begin{minipage}[c][8cm]{\textwidth}
\centering
\smartdiagramset{
uniform color list=orange!60!yellow for 5 items,
circular final arrow disabled=false,
circular distance=2.75cm,
arrow tip=to,
arrow line width=2pt,
additions={
additional item bottom color=orange!60!yellow,
additional item border color=gray,
additional item shadow=drop shadow,
additional item offset=1.65cm,
additional arrow line width=2pt,
additional arrow tip=to,
additional arrow color=orange!60!yellow,
}
}
\smartdiagramadd[circular diagram]{
aa,bb,cc,dd
}{
above of module1/Bananas,right of module4/Pears
}
\smartdiagramconnect{to-}{module1/additional-module1}
\smartdiagramconnect{-to}{module4/module1}  % Rectify this line 
\smartdiagramconnect{-to}{module4/additional-module2}
\end{minipage}

\end{document}

Question

  • How can I put the string "No" on top of the curved arrow from dd to aa
  • How can I put the string "Yes" on top of the straight arrow from dd to Pears
3kstc
  • 931
  • 6
  • 22

1 Answers1

8

Some time ago I answered a question in which the smartdiagram commands got modified, and I modified them further. These modified versions allow you to place labels. I do not know who initiated these modifications. So to first approximation I'd like to propose

\documentclass[a4paper,12pt]{extarticle}
\usepackage{geometry}

\geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=20mm,
 }

\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions} 
\usepackage{tikz}
\usetikzlibrary{arrows,quotes} 
\RenewDocumentCommand{\smartdiagramconnect}{m m}{%
    \begin{tikzpicture}[remember picture,overlay]
    \foreach \start/\end in {#2}
    \draw
    (\start) edge[additional item arrow type,#1] (\end);
    \end{tikzpicture}
}

\NewDocumentCommand{\smartdiagramindividualconnect}{m}{%
    \begin{tikzpicture}[remember picture,overlay]
    \foreach \Y/\Z [count=\X starting from 2] in {#1}
    {
    \draw[additional item arrow type,\Y] (planet) to 
    node[midway,sloped,above]{\Z}
    (satellite\X) ;}
    \end{tikzpicture}

}
\begin{document}

\bigbreak
\begin{minipage}[c][8cm]{\textwidth}
\centering
\smartdiagramset{
uniform color list=orange!60!yellow for 5 items,
circular final arrow disabled=false,
circular distance=2.75cm,
arrow tip=to,
arrow line width=2pt,
additions={
additional item bottom color=orange!60!yellow,
additional item border color=gray,
additional item shadow=drop shadow,
additional item offset=1.65cm,
additional arrow line width=2pt,
additional arrow tip=to,
additional arrow color=orange!60!yellow,
}
}
\smartdiagramadd[circular diagram]{
aa,bb,cc,dd
}{
above of module1/Bananas,right of module4/Pears
}
\smartdiagramconnect{to-}{module1/additional-module1}
\smartdiagramconnect{-to,bend right,shorten >=8pt,shorten <=8pt,"no"
{midway,above right,text=black}}{module4/module1}  % Rectify this line 
\smartdiagramconnect{-to,shorten >=4pt,shorten <=4pt,"yes"
{midway,above,text=black}}{module4/additional-module2}
\end{minipage}

\end{document}

enter image description here

  • That's awesome! Thank you, thought, is there a way of change the font colour from yellow to black? I tried "black" (\smartdiagramconnect{-to,bend right,shorten >=8pt,shorten <=8pt,black,"no" midway,below}{module4/module1}) and the text and the arrow became black. :/ – 3kstc Jan 10 '19 at 04:54
  • @3kstc Sure, that's easy. I added the color information and moved the labels. –  Jan 10 '19 at 05:01
  • @3kstc You're welcome! –  Jan 10 '19 at 05:03
  • Is there any way to make the line from dd to Pears dotted or dashed? – mariabc Aug 06 '20 at 13:27