我正在尝试在一个简单的 tikzpicture 中重新创建该图表:
我可以得到大致的形状:
\begin{center}
\begin{tikzpicture}
\node[inner sep=0pt,minimum size=4pt] (e) at (0,2) {$E$};
\node[inner sep=0pt,minimum size=4pt] (a) at (2,2) {$A$};
\node[inner sep=0pt,minimum size=4pt] (b) at (4,2) {$B$};
\node[inner sep=0pt,minimum size=4pt] (c) at (1,0) {$C$};
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (e) to node [above=3pt] {$i$} (a);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (a) to node [above=3pt] {$f$} node [below=3pt] {$g$} (b);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (c) to node [left=7pt] {$k$} (e);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (c) to node [left=7pt] {$h$} (a);
\end{tikzpicture}
\end{center}
但是,我不知道如何获取包含箭头样式 - 我可以在 TikZ 手册中看到有一个名为的箭头尖right hook
,但我不确定如何使用它;另外,我想保留隐形箭头尖。我不确定的另一件事是如何最好地制作双箭头。
我已经找到了 tikzcd 包 - 我不想使用它;它破坏了我已经编写的内容的风格(相当多)。
答案1
tikz
一种使用和的方法arrows
。
放置right hook
在 之前-stealth
。通过一些位置调整,您还可以放置两个平行箭头,请参阅path
命令。
输出:
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[inner sep=0pt,minimum size=4pt] (e) at (0,2) {$E$};
\node[inner sep=0pt,minimum size=4pt] (a) at (2,2) {$A$};
\node[inner sep=0pt,minimum size=4pt] (b) at (4,2) {$B$};
\node[inner sep=0pt,minimum size=4pt] (c) at (1,0) {$C$};
\draw[right hook-stealth, shorten <= 3pt, shorten >= 3pt] (e) to node [above=3pt] {$i$} (a);
\path[-stealth, shorten <= 3pt, shorten >= 3pt]
([yshift=-2pt]a.east) edge node [above,yshift= 1.0ex] {$f$} ([yshift=-2pt]b.west)
([yshift= 2pt]a.east) edge node [below,yshift=-1.0ex] {$g$} ([yshift= 2pt]b.west);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt, dashed] (c) to node [left=7pt] {$k$} (e);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (c) to node [left=7pt] {$h$} (a);
\end{tikzpicture}
\end{center}
\end{document}
答案2
答案3
另一种可能的方法是直接用 Ti 绘制钩箭头钾z 使用arc
。对于双箭头,使用节点锚点。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[inner sep=0pt,minimum size=4pt] (e) at (0,2) {$E$};
\node[inner sep=0pt,minimum size=4pt] (a) at (2,2) {$A$};
\node[inner sep=0pt,minimum size=4pt] (b) at (4,2) {$B$};
\node[inner sep=0pt,minimum size=4pt] (c) at (1,0) {$C$};
\draw[-stealth] ([xshift=2ex,yshift=1ex] e) arc (90:270:0.5ex)--(a)node[midway, above]{$i$};
% \draw[-stealth, shorten <= 3pt, shorten >= 3pt] (a) to node [above=3pt] {$f$} node [below=3pt] {$g$} (b);
\draw[dashed,-stealth, shorten <= 3pt, shorten >= 3pt] (c) to node [left=7pt] {$k$} (e);
\draw[-stealth, shorten <= 3pt, shorten >= 3pt] (c) to node [left=7pt] {$h$} (a);
\draw[-stealth] (a.north east)--(b.north west)node[midway, above]{$f$};
\draw[-stealth] (a.south east)--(b.south west)node[midway, below]{$g$};
\end{tikzpicture}
\end{center}
\end{document}