带标签的箭头

带标签的箭头

如何给箭头添加标签?

\documentclass{article}
 \usepackage{tikz} 
\tikzstyle{every picture}+=[remember picture] 
\tikzstyle{na} = [shape=rectangle,inner sep=0pt]   
\newcommand{\ptFleche}[2]{   \tikz[baseline=(#1.base)]\node[na](#1){#2}; } 
\newcommand{\Fleche}[5][thick]{ \begin{tikzpicture}[overlay] \path[->,#1](#2)  edge [out=#4, in=#5] (#3) ;
\end{tikzpicture} }

\begin{document} 

 $$f(x)=\left\{
\begin{array}{ccc}
\ptFleche{mot1}{$f_1(x)$} & ,& x\in A \\
& & \\
\ptFleche{mot3}{$f_2(x)$} & ,&x\in B
\end{array}\right .\;\;\;\;,\;\;\;\;g(x)=\left\{
\begin{array}{ccc}
\ptFleche{mot2}{$g_1(x)$} & ,&x\in C\\
& & \\
\ptFleche{mot4}{$g_2(x)$} & ,&x\in D
\end{array}\right .$$  

\Fleche[blue,line width=1.0pt]{mot1}{mot4}{20}{150}

\end{document}

我有的绘图

在此处输入图片描述

我想要的图画

在此处输入图片描述

任何暗示都将表示感谢。

答案1

像这样?

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{quotes}% <---

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [shape=rectangle,inner sep=0pt]
\newcommand{\ptFleche}[2]{   \tikz[baseline=(#1.base)]\node[na](#1){#2}; }
\newcommand{\Fleche}[6][thick]{\begin{tikzpicture}[overlay] 
                               \path[->,#1](#2)  edge [out=#4, in=#5, "#6"] (#3);% <---
                               \end{tikzpicture} }

\begin{document}

 \[
f(x)=\left\{
\begin{array}{ccc}
\ptFleche{mot1}{$f_1(x)$} & ,& x\in A \\
& & \\
\ptFleche{mot3}{$f_2(x)$} & ,&x\in B
\end{array}\right .\;\;\;\;,\;\;\;\;g(x)=\left\{
\begin{array}{ccc}
\ptFleche{mot2}{$g_1(x)$} & ,&x\in C\\
& & \\
\ptFleche{mot4}{$g_2(x)$} & ,&x\in D
\end{array}\right .
\]

\Fleche[blue,line width=1.0pt]{mot1}{mot4}{20}{150}{$f_1g_2$}% <---
\end{document}

相关内容