2

How can I add a label to an arrow?

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

Drawing that I have

enter image description here

Drawing that I want

enter image description here

Any hint would be appreciation.

1 Answer 1

5

like this?

enter image description here

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

You must log in to answer this question.

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