# Drawing function relations

Let's say I have three sets, A, B and C and some functions between them. How could I draw in LaTeX a diagram with arrows between these sets to show which functions relate them to which?

• Welcome to TeX.SE! What you try so far? Can provide an sketch, how this relations should look? See tikz-cd package, it seems that it provide what you looking for. – Zarko Oct 13 at 11:40
• Welcome to TeX - LaTeX! Have a look at question related to tikz and sets. May be tex.stackexchange.com/q/460422/15925 is relevant. If you don't find what you need, please specify more clearly with a sketch of the type diagram you want. – Andrew Swann Oct 13 at 11:42

Something like this?

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz-cd}
\tikzset{set/.style={circle,draw=#1,fill=#1!20}}
\begin{document}
$\begin{tikzcd} |[set=red]|A \arrow[rr,bend left=10,"f"] \arrow[dr,bend left=10,"h"] & & |[set=DarkGreen]| B \arrow[ll,bend left=10,"f^{-1}"] \arrow[dl,bend left=10,"g"]\\[3em] & |[set=blue]| C \arrow[ur,bend left=10,"g^{-1}"] \arrow[ul,bend left=10,"h^{-1}"]& \end{tikzcd}$
\end{document}

A way to make such a diagram with pstricks:

\documentclass[svgnames]{article}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}

\begin{document}

$\psset{arrows=->, arrowinset=0.12, labelsep=2pt, linejoin=1} \begin{psmatrix}[mnode=circle, framesep = 10pt, fillstyle = solid, rowsep=2.4cm ] %%% nodes [fillcolor=Lavender!60, linecolor=DarkMagenta] A & & [fillcolor=LavenderBlush, linecolor=FireBrick] B \\ & [fillcolor=PapayaWhip, linecolor=SaddleBrown] C %%% arrows \psset{arcangle=12, nodesep=-0.4pt, fillstyle=none, shortput=nab} \ncarc{1,1}{1,3}^{f }\ncarc{1,3}{1,1}^{f^{-1}} \ncarc{1,1}{2,2}^{h^{-1}} \ncarc{2,2}{1,1}^{h} \ncarc{1,3}{2,2}^{g} \ncarc{2,2}{1,3}^{g^{-1}} \end{psmatrix}$\bigskip

\end{document}