2

In this post I have found a very useful answer to made the Mayer-Vietoris sequence for homology using tikz-cd. However, I need some help creating a diagram like this: The Mayer-Vietoris sequence for cohomology

I want to draw it using the same package, but I cannot modify correctly the code given in the post to draw the reverse arrow for the connecting homomorphism. This is the code that I have tried to modify, but have had no success.

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

\tikzset{
  curarrow/.style={
  rounded corners=8pt,
  execute at begin to={every node/.style={fill=red}},
    to path={-- ([xshift=50pt]\tikztostart.center)
    |- (#1) node[fill=white] {$\scriptstyle d^*$}
    -| ([xshift=-50pt]\tikztotarget.center)
    -- (\tikztotarget)}
    }
}

\begin{document}

   \begin{tikzcd}[arrow style=math font,cells={nodes={text height=2ex,text depth=0.75ex}}]
       H^{k+1}(M) \arrow[r, "i^{*}"] & H^{k+1}(U) \oplus H^{k+1}(V) \arrow[r] & \cdots \\
       H^{k}(M) \arrow[r, "i^{*}"] & H^{k}(U) \oplus H^{k}(V) \arrow[r, "j^{*}"] \arrow[draw=none]{u}[name=Y, shape=coordinate]{} \arrow[draw=none]{d}[name=Z,shape=coordinate]{} & H^{k}(U \cap V) \arrow[curarrow=Y]{ull}{} \\
       \cdots \arrow[r] & H^{k-1}(U) \oplus H^{k-1}(V) \arrow[r, "j^{*}"] & H^{k-1}(U \cap V) \arrow[curarrow=Z]{ull}{}
   \end{tikzcd}

\end{document}
  • Related: tex.stackexchange.com/questions/344489/… – egreg Dec 23 '16 at 15:13
  • So the code compiled for you? I get an error ! Package pgf Error: No shape named tikz@f@1-0-7 is known. See the pgf package documentation for explanation. Type H <return> for immediate help ... l.160 I think the culprit is a tikzcd arrow in cell 1-7. \errmessage ...currentrow -\tikzcd@currentcolumn } l.164 \end{tikzcd} from the only code there that seems to use tikz-cd. How did you resolve it? Or did it compile for you? – cfr Dec 24 '16 at 3:39
  • You didn't actually try even compiling the code which was there as is, did you? Let alone attempt to modify it? – cfr Dec 24 '16 at 3:49
  • @cfr I compiled the code and it worked fine for me, using pdflatex for my latex file. I have edited the post to add the code that I tried to modify. – limber Dec 24 '16 at 17:54
  • You have now, but you didn't before posting your question. I posted that code after posting my comments here and fixing the original in the answer to the question you linked. That code can't be what you said you'd tried to modify because the code was only available after I fixed it. – cfr Dec 25 '16 at 1:18
2

I created a working modification of the code block you posted:

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

\tikzset{
  curarrow/.style={
  rounded corners=8pt,
  execute at begin to={every node/.style={fill=red}},
    to path={-- ([xshift=-50pt]\tikztostart.center)
    |- (#1) node[fill=white] {$\scriptstyle d_*$}
    -| ([xshift=50pt]\tikztotarget.center)
    -- (\tikztotarget)}
    }
}

\begin{document}

    \begin{tikzcd}[arrow style=math font,cells={nodes={text height=2ex,text depth=0.75ex}}]
       \cdots & H_{k-1}(U) \oplus H_{k-1}(V) \arrow[l] \arrow[draw=none]{d}[name=Y, shape=coordinate]{} & \arrow[l] H_{k-1}(U \cap V) \\
       H_{k}(M) \arrow[curarrow=Y]{urr}{} & H_{k}(U) \oplus H_{k}(V) \arrow[l] \arrow[draw=none]{d}[name=Z,shape=coordinate]{} & H_{k}(U \cap V) \arrow[l] \\
       H_{k+1}(M) \arrow[curarrow=Z]{urr}{} & H_{k+1}(U) \oplus H_{k+1}(V) \arrow[l] & \cdots \arrow[l]
   \end{tikzcd}

\end{document}

enter image description here

The changes I made:

  • in the code block you posted, following the middle middle position H^{k}(U) \oplus H^{k}(V), there were two coordinate-setting arrows

    \arrow[draw=none]{u}[name=Y, shape=coordinate]{} \arrow[draw=none]{d}[name=Z,shape=coordinate]{}

    These coordinates are used to set the position of the boundary map labels: the Y coordinate is set between the middle middle and middle top (via an upward pointing arrow), and the Z coordinate is set between the middle middle and middle bottom (via a downward pointing arrow). I want to send an arrow from the middle left to the upper right, but the coordinate Y must be defined before I use it, so I moved the definition to the middle top, pointing down to the middle middle.

  • I modified the definition of the curarrow style slightly. In the original, the path starts by moving to the right by 50pt, turning around, then overshooting to the left by 50pt before ending; these are reflected in the xshifts. Since the orientation of the arrow is reversed, I reversed the signs on the xshifts to reflect the change.

  • Obviously the arrows are reversed. Since the original code block produced Mayer-Vietoris for cohomology and the arrows have been reversed, I also took the liberty of switching the groups to homology groups. This is probably not what you wanted, sorry.

| improve this answer | |
  • Thank you! This works perfectly fine for me and it's exactly what I wanted. Very good explanation of the changes made in the original code. Now I can understand why my modified code was not working. – limber Dec 24 '16 at 22:49
2

You can obtain this diagram with pstricks and a psmatrix environment. For the connecting homomorphism, I add intermediate empty nodes at each end, between consecutives rows, and connect them with a composite path:

\documentclass{article}
\usepackage{pst-node,  auto-pst-pdf}

\begin{document}

 \[  \def\psrowhookiii{\psset{mrow=r}}
  \begin{psmatrix}[rowsep=1.35]
  \pnode[-0.5,0]{A}\\
  \pnode[1,1]{A2}H^{q+1}_c(M) & H^{q + 1}_c(U) \oplus H^{q + 1}_c(V) & H^{q + 1}_c(U \cap V)\pnode[0,-0.8]{B2}\\
   \pnode[0,1]{A3}  H^q_c(M) & H^q_c(U) \oplus H^q_c(V) & H^q_c(U \cap V)\pnode[-1,-0.8]{B3}\\
       & &   \pnode{B}
       \psset{arrows=->, arrowinset=0.12, nodesep=4pt,  linearc=0.4}
       \ncline{2,3}{2,2} \ncline{2,2}{2,1}\ncbar[angle=180, ]{2,1}{A2}%
       \ncbar[arm=0.7, angle=180, arrows=-, nodesepB=0]{3,1}{A3}\ncline[arrows=-, nodesep=0]{A3}{B2}\nbput[labelsep=1.5pt]{d^*}%
       \ncbar[arm=0.76, angle=0, arrows=->, nodesepA=0]{B2}{2,3}%
       \ncline{3,3}{3,2} \ncline{3,2}{3,1}\ncbar[arm=0.76, angle=0, arrows=->, nodesepA=0]{B3}{3,3}%
    \end{psmatrix} \]

\end{document} 

enter image description here

| improve this answer | |
  • The diagram is perfect, but I get an error when I compile the code using pdflatex. – limber Dec 24 '16 at 18:37
  • 1
    Oh! yes, of course. You have to add the compiler switch --enable-write18 if you're under MiKTeX, or -shell-escape for TeX Live and MacTeX. Alternatively, don't load auto-pst-pdf and compile with xelatex. – Bernard Dec 24 '16 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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