4

I'm drawing some commutative diagrams, and some of my diagonal arrows are crossing nodes on their way. I would like to have a sort of "crossing under", to force the arrow not to show while crossing the node.

I copy the code here:

\begin{tikzcd}
%first row
A \ar[rr] \ar[dd] \ar[dr]
& 
& B \ar[dd] \ar[dr]
& 
\\
%second row
& E \ar[rr] \ar[dd]
& 
& F \ar[dd]
\\
%third row
C \ar[rr] \ar[dr] \ar[uurr]
& 
& D \ar[dr]
& 
\\
%forth row
& G \ar[rr] \ar[uurr]
& 
& H
\end{tikzcd}

enter image description here

As you can see, it is very unelegant! It would be nicer if the arrows "interrupted" and started again after the node.

Thanks!

6

Splitting into multiple arrows:

\documentclass{article}

\usepackage{tikz-cd}
\usepackage{xcolor}

\begin{document}

\begin{tikzcd}
%first row
A \ar[rr] \ar[dd] \ar[dr]
& 
& B \ar[dd] \ar[dr]  \ar[from=dl]
& 
\\
%second row
& E \ar[rr] \ar[dd] \ar[-,dl]
& 
& F \ar[dd]
\\
%third row
C \ar[rr] \ar[dr]
& 
& D \ar[dr] \ar[ur]
& 
\\
%forth row
& G \ar[rr] \ar[-,ur]
& 
& H
\end{tikzcd}

\end{document}

enter image description here

Avoiding the nodes:

\documentclass{article}

\usepackage{tikz-cd}
\usepackage{xcolor}

\begin{document}

\begin{tikzcd}
%first row
A \ar[rr] \ar[dd] 
& 
& B \ar[dd] \ar[dr] \ar[from=ddll,bend left=30]
& 
\\
%second row
& E \ar[rr] \ar[dd] \ar[from=ul,crossing over]
& 
& F \ar[dd]
\\
%third row
C \ar[rr] \ar[dr] 
& 
& D \ar[dr]
& 
\\
%forth row
& G \ar[rr] \ar[from=uurr,bend left=30,crossing over]
& 
& H
\end{tikzcd}
\end{document}

enter image description here

| improve this answer | |
  • Thank you for both suggestions, but my diagrams are growing more an more complicated, so I prefer to avoid adding or bending arrows. Thank you again! – Barbara Giunti Jun 9 '19 at 11:34
6

Just for fun: an attempt to give a 3D impression.

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{backgrounds}
\usepackage{contour}
\contourlength{1pt}
\begin{document}
\[\begin{tikzcd}[execute at end picture={
\begin{scope}[on background layer]
 \draw[->] (C) -- (B);
\end{scope}
 \draw[preaction={draw,line width=2.4pt,white},->] (G) -- (F);
}]
%first row
A \ar[rr] \ar[dd] \ar[dr]
& 
& |[alias=B]| B \ar[dd] \ar[dr]
& 
\\
%second row
& \contour{white}{$E$} \ar[rr] \ar[dd]
& 
&|[alias=F]| F \ar[dd]
\\
%third row
|[alias=C]| C \ar[rr] \ar[dr] %\ar[uurr]
& 
& D \ar[dr]
& 
\\
%forth row
& |[alias=G]| G \ar[rr] %\ar[uurr]
& 
& H
\end{tikzcd}\]
\end{document}

enter image description here

| improve this answer | |
  • Oh, that is really nice. I'm so sorry my diagrams are getting too involuted for that! Thank you, I sincerely appreciated the effort! – Barbara Giunti Jun 10 '19 at 7:48
  • @BarbaraGiunti Honestly I think you should accept the answer by user190633. The currently accepted answer is very fragile. Think of newcomers who may think that the accepted answer may be the "best" one. Of course, this is just my opinion, and you can do what you want. – user121799 Jun 10 '19 at 16:56
  • I think you're right, it was working for me, so I didn't notice the problem either. Thanks for the suggestions, I'm a newcomer myself! – Barbara Giunti Jun 11 '19 at 13:46
5

This does what you want:

\documentclass[pdf]{article}
\usepackage{tikz-cd}

\begin{document}

\[ 
\begin{tikzcd}
%first row
A \ar[rr] \ar[dd] \ar[dr]
&
& B \ar[dd] \ar[dr]
&
\\
%second row
& E \ar[rr] \ar[dd]
&
& F \ar[dd]
\\
%third row
C \ar[rr] \ar[dr] \ar[uurr, "\textstyle E" description]
&
& D \ar[dr]
&
\\
%forth row
& G \ar[rr] \ar[uurr, "\textstyle D" description]
&
& H
\end{tikzcd}
    \]

\end{document} 

enter image description here

| improve this answer | |
  • Thanks! That was exactly what I wanted! – Barbara Giunti Jun 9 '19 at 11:32
  • This is very fragile. Replace e.g. B by \displaystyle\int_0^1. – user121799 Jun 9 '19 at 19:55
  • @marmot: ??? I see no problem on compiling. – Bernard Jun 10 '19 at 0:01
  • @Bernard Really? How does the bottom the E look like when you compile it? I get a fragment of the E that lies underneath on my just updated TeXLive2019 distribution when compiling this with pdflatex and B replaced by \displaystyle\int_0^1. If you give things some reduced opacity by saying \begin{tikzcd}[opacity=0.5] ... you understand why. – user121799 Jun 10 '19 at 0:49
  • @marmot: I hadn't noticed it – I must say I didn't zoom out. A workaround seems to replace $E$ and $D$ (the nodes, not the ‘descriptions’) with \phantom{E/D} – unless you find out another problem with this way. I'll update the code in a moment, with some improvements. – Bernard Jun 10 '19 at 9:33

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.