\documentclass[convert = false, tikz]{standalone}
\usepackage{float}
\begin{document}
\begin{tikzpicture}[every node/.style={midway}]
\matrix[column sep={4em,between origins}, row sep={2em}] at (0,0) {
\node(A) {$A$} ; & \node(B) {$B$}; \\
\node(C) {$C$} ; & \node (D) {$D$};\\
};
\draw[<-] (C) -- (D) node[anchor=east]{};
\draw[->] (A) -- (B) node[anchor=south] {};
\draw[->] (B) -- (D) node[anchor=west] {};
\draw[->] (C) -- (D) node[anchor=north] {};
\end{tikzpicture}
\end{document}
在这里,我尝试使用 $A$ 到 $C$ 之间的包含箭头。您能给我提点建议吗?谢谢
答案1
使用left hook->
或right hook->
来自库箭头:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[every node/.style={midway}]
\matrix[column sep={4em,between origins}, row sep={2em}] at (0,0) {
\node(A) {$A$}; & \node(B) {$B$}; \\
\node(C) {$C$}; & \node(D) {$D$}; \\
};
\draw[<->] (C) -- (D) node[anchor=east]{};
\draw[->] (A) -- (B) node[anchor=south]{};
\draw[->] (B) -- (D) node[anchor=west]{};
\draw[right hook->] (A) -- (C) node[anchor=north]{};
\end{tikzpicture}
\end{document}
答案2
更加紧凑tikz-cd
\documentclass{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \arrow{r} \arrow[hookrightarrow]{d} & B \arrow{d}
\\
C \arrow[leftrightarrow]{r} & D
\end{tikzcd}
\end{document}