Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\begin{tikzpicture}[scale=1.5]

\node (A) at (0,0) {$0$};
\node (B) at (1,0) {$H^0(G,P)$};
\node (C) at (2,0) {$H^0(G,M)$};
\node (D) at (3,0) {$H^0(G,N)$};
\node (E) at (1,-1) {$H^1(G,P)$};
\node (F) at (2,-1) {$H^1(G,M)$};
\node (G) at (3,-1) {$H^1(G,N)$};
\path[->,font=\scriptsize,>=angle 90]
(A) edge node[above]{} (B)
(B) edge node[above]{$\phi$} (C)
(C) edge node[above]{$\psi$} (D)
(D) edge node[above]{} (E)
(E) edge node[above]{} (F)
(F) edge node[above]{} (G);

\end{tikzpicture}

So I've got this that I want to try and draw a 'nice' connecting homomorphism which I'll try my best to describe: It starts from the end of the last element in the first row and ends at the beginning of the first element in the second row.

Maybe it's better to do it in tikzcd but I don't know how to do that either.

share|improve this question
1  

2 Answers 2

up vote 8 down vote accepted

With TikZ only

Code

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,quotes}
\begin{document}
\begin{tikzpicture}[scale=2]
\matrix(m)[matrix of math nodes,column sep=15pt,row sep=15pt]{
  0 & H^0(G,P) & H^0(G,M) & H^0(G,N) \\
    & H^1(G,P) & H^1(G,M) & H^1(G,N) \\
};
\draw[->,font=\scriptsize,every node/.style={above},rounded corners]
  (m-1-1) edge (m-1-2) 
  (m-1-2) edge["$\phi$"] (m-1-3)
  (m-1-3) edge["$\psi$"] (m-1-4)
  (m-1-4.east) --+(5pt,0)|-+(0,-7.5pt)-|([xshift=-5pt]m-2-2.west)--(m-2-2.west)
  (m-2-2) edge (m-2-3)
  (m-2-3) edge (m-2-4)
;
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer
    
How may I add in $\delta$ as a label on the longest arrow? –  Haikal Yeo Aug 4 at 14:46
    
@HaikalYeo: You can add node[pos=<num>]{$\delta$} to the 4th line after the \draw` command. Depending on where on the line you want $\delta$ to be, you may want to put the node code before or after the coordinates, and then use pos to adjust its position. –  Kevin C Aug 4 at 20:31
    
Sorry if I sound really stupid here but do I replace node and num with something else? –  Haikal Yeo Aug 4 at 21:05
    
Ooh. I get it already. Except I don't know how to adjust <num> –  Haikal Yeo Aug 4 at 21:07
1  
@HaikalYeo: <num> is a number between 0 and 1, which controls the position of the node on a path. For example, (m-1-4.east) --+(5pt,0)|-+(0,-7.5pt)-|node[pos=.25]{$\delta$}([xshift=-5pt]m-2-2.west)--(m-2-‌​2.west) will put the node at the middle of the longest line. –  Kevin C Aug 5 at 0:10

With tikz-cd it's a piece of cake:

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[scale=1.5]
0 \arrow{r} &
H^0(G,P) \arrow{r}{\phi} &
H^0(G,M) \arrow{r}{\psi} &
H^0(G,N) \arrow{dll} \\
&
H^1(G,P) \arrow{r} &
H^1(G,M) \arrow{r} &
H^1(G,N)
\end{tikzcd}

\end{document}

enter image description here

With a modification of the example in the documentation at the end of page 11 we can get a bent arrow:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}           
0 \arrow{r} &
H^0(G,P) \arrow{r}{\phi} &
H^0(G,M) \arrow{r}{\psi} \arrow[phantom, ""{coordinate, name=Z}]{d} &
H^0(G,N)
  \arrow[
    rounded corners,
    to path={
      -- ([xshift=2ex]\tikztostart.east)
      |- (Z) [near end]\tikztonodes
      -| ([xshift=-2ex]\tikztotarget.west)
      -- (\tikztotarget)
    }
  ]{dll} \\
&
H^1(G,P) \arrow{r} &
H^1(G,M) \arrow{r} &
H^1(G,N)
\end{tikzcd}

\end{document}

enter image description here

share|improve this answer
1  
Is it possible to bend the arrow such that it starts at the right side of H^0(G,N) and then ends at the left side of H^1(G,P), making an inverted S shape? –  Haikal Yeo Jun 11 at 22:01
3  
@HaikalYeo Yes, it's possible. I'm not saying I fully understand the code, I just adapted it from an example in the documentation. –  egreg Jun 11 at 22:13
    
Which documentation are you referring to? May I have the link to it? –  Haikal Yeo Jun 11 at 22:46
    
@HaikalYeo The documentation of tikz-cd; you should have it on your system, but you can find it online at texdoc.net/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf –  egreg Jun 11 at 22:47
    
I used the exact same code but there is an additional down arrow from H^0(G,M) to H^1(G,M). How do I remove this? –  Haikal Yeo Jun 12 at 8:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.