In Xy-pic
:
\documentclass{article}
\usepackage[all,2cell]{xy}
\UseAllTwocells
\begin{document}
\xymatrixcolsep{3cm}
\xymatrix{
A \ruppertwocell^f{\alpha}
\rlowertwocell_h{\beta}
\ar[r]|{g}
&B\\
}
\end{document}
In TikZ:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\begin{document}
\begin{tikzpicture}
\node (a) {$A$};
\node[right=4cm of a] (b) {$B$};
\draw[->]
(a) edge node[fill=white] (g) {$g$} (b)
(a) edge[bend left] node (f) [above]{$f$} (b)
(a) edge[bend right] node (h) [below]{$h$} (b);
\draw[shorten <=2pt,shorten >=2pt,-implies]
(f) edge[double] (g)
(g) edge[double] (h);
\end{tikzpicture}
\end{document}
Here's one option using the tikz-cd package which facilitates the creation of commutative diagrams:
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& X\arrow[Rightarrow]{dr}{}\arrow[Rightarrow,to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{} \\
A \arrow[Rightarrow]{ur}{}\arrow{r}{}\arrow{d} & B \arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} & D\arrow{d}\\
E \arrow[Rightarrow]{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H\\
& I\arrow[Rightarrow]{ur}{}\\
\end{tikzcd}
\end{document}
If all the arrows should be given the style of \Rightarrow
, it's enough to use the arrows=Rightarrow
option:
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[arrows=Rightarrow]
& X\arrow{dr}{}\arrow[to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{} \\
A \arrow{ur}{}\arrow{r}{}\arrow{d} & B \arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} & D\arrow{d} \\
E \arrow{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H \\
& I\arrow{ur}{}
\end{tikzcd}
\end{document}
I initially forgot question 2. You can use the in=
, out=
keys to bend the arrows:
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[arrows=Rightarrow]
& X\arrow{dr}{}\arrow[to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{} \\
A \arrow{ur}{}\arrow[out=30,in=150]{r}{}\arrow{d} & B \arrow[out=210,in=330]{l}{}\arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} & D\arrow{d} \\
E \arrow{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H \\
& I\arrow{ur}{}
\end{tikzcd}
\end{document}
Best Answer
This solution draw the diagram via
tikz
. Two styles are defined for blocks and lines respectively. To draw a line,label.anchor
is used where anchor=north, south, east, and west.Code