TransWikia.com

How to add text above some arrows?

TeX - LaTeX Asked on August 14, 2021

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

One Answer

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}
    (satelliteX) ;}
    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

Correct answer by user121799 on August 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP