如何在一些箭头上方添加文字?

如何在一些箭头上方添加文字?

我正在尝试创建下图:

在此处输入图片描述 我当前的输出是:

在此处输入图片描述 平均能量损失

我的MWE如下:

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

问题

  • 我怎样才能将字符串“No”放在从dd到的弯曲箭头上方aa
  • 我怎样才能将字符串“是”放在从dd到的直箭头上方Pears

答案1

不久前我回答过智能图表命令被修改的问题, 和我进一步修改了它们。这些修改版本允许您放置标签。我不知道是谁发起了这些修改。因此,首先,我想提出

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

在此处输入图片描述

相关内容