假设我有三个集合,A、B 和 C,它们之间有一些函数。我如何在 LaTeX 中绘制一个带有这些集合之间箭头的图表,以显示哪些函数与哪些函数相关?
答案1
像这样吗?
\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}
答案2
制作此类图表的方法是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}