1

I am trying to recreate this diagram in a simple tikzpicture:

enter image description here

I can get the general shape:

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

However, I don't know how to get the include arrow style - I can see in the TikZ manual that there is an arrow tip called right hook, but I'm not sure how to use it; also, I want to keep the stealth arrow tips. The other thing I'm not sure about is how to best make the double arrow.

I have already found the tikzcd package - I don't want to use it; it breaks the style of what I have already written (which is quite a lot).

1
  • Perhaps you should take a look at the tikz-cd package it offers a tikz based interface for making diagrams like this
    – daleif
    Commented Jun 28, 2019 at 13:30

3 Answers 3

1

An approach with tikz and arrows.

Place right hook before -stealth. With some position adjustment you can also place two parallel arrows, see the path command.

Output:

enter image description here

Code:

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

With tikz-cd.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=1em,row sep=2em]
 E \arrow[rr,hook,"i"] && A \arrow[rr,yshift=2pt,"f"] \arrow[rr,yshift=-2pt,"g"
 '] & ~ &B\\
 & C\arrow[ul,dashed,"h"] \arrow[ur,"k"] & &&
\end{tikzcd}
\end{document}

enter image description here

0

A possible another approach is direct drawing of hooked arrow with Tikz using arc. For double arrow, use the node anchors.

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

enter image description here

2
  • Probably not a good idea to set the inner sep to zero here, compare to marmots solution that uses tikz-cd
    – daleif
    Commented Jun 28, 2019 at 14:17
  • Yes it is not a good idea, it was just for fun.
    – user31034
    Commented Jun 28, 2019 at 14:19

You must log in to answer this question.

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