For Halloween or not, I am trying to make the following-like "spider" web diagram through tikzcd, roughly like this (of course I am just drawing the more ugly version of it, the arrow should be thin) enter image description here but I have failed embarrassingly so far: enter image description here I failed because I wanted to aim for the following criteria:

  1. ai and aii align in the same vertical axis,

  2. b itself is on its vertical axis

  3. ci, ciii and cii align in the same vertical axis,

  4. d itself is on its vertical axis

  5. edi and eiii align in the same vertical axis,

  6. f itself is on its vertical axis

  7. The horizontal distance between the neighbor vertical axes of the same initial alphabets are the same (namely, the distance between the vertical a axis, the vertical b axis, the vertical c axis, the vertical d axis, the vertical e axis, the vertical f axis are the same).

Here is my minimal work template and my trial:



BO\ar[r,"w_1^2+w_2"] &K(\Z/2,2)

Could you please kindly provide me a guideline and a possible sample to it?

I am happy to use \usepackage{tikz-cd} or \usepackage[all,cmtip]{xy}. You are also allowed to use bend (e.g \ar[uur,bend left= ...,""] if you wish)

Thank you in advance to the Halloween superhero experts here!! :-)

enter image description hereenter image description here


I would use a matrix of math nodes (section 57.1, page 646 of the current tikz manual). This gives you an easy way of laying out b, d, f, etc. in a grid so that you automatically get your vertical alignment. Once you have all of the vertices in place then you can draw the many edges using a \foreach statement to produce:

enter image description here

Here is the full code:

\documentclass[tikz, border=2mm]{standalone}

    \begin{tikzpicture}[>=stealth,->,shorten >=2pt,looseness=.5,auto]
      \matrix (M)[matrix of math nodes,row sep=1cm,column sep=16mm]{
          & b &    & d &    & f\\
        ai&   & ci &   &cdi &\\
          &   &ciii&   &eiii\\
       aii&   &cii\\
       \foreach \a/\b in {1-2/1-4, 1-4/1-6, 2-1/2-3, 2-3/2-5, 
                          3-3/3-5, 4-1/4-3, 2-1/1-2, 2-3/1-4, 
                          2-5/1-6, 3-3/2-5, 3-5/1-6, 4-1/3-3, 
                          4-3/3-5, 2-1/3-3, 3-3/1-4, 4-3/1-4} {


The (M) after \matrix means that the nodes have labels (M-1-2), (M-1-4) etc. in the non-empty cells (with the option nodes in empty cells you can have nodes in the empty cells too). You can change (M) to anything you like.

You can adjust the spacing by changing row sep=1cm,column sep=16mm to suit your tastes.

  • You forgot the arrow between aii and b :) – CarLaTeX Oct 31 '17 at 6:45
  • @CarLaTeX Oops, sorry! Exercise for the reader:) – Andrew Oct 31 '17 at 7:04
  • You wanted to see if s/he is attentive :) – CarLaTeX Oct 31 '17 at 7:06
  • thanks +1, this looks nice. I think it will be compatible to minipage for each symbol, yes or no? :-) – wonderich Oct 31 '17 at 13:49
  • @wonderich My understanding is that each element in the matrix is a tikz node. To some extend these function like mini-pages, perhaps, but they are not the same. – Andrew Oct 31 '17 at 14:18

It's very simple to do it with tikz-cd.

You can also choose the arrow tip you like with:

\tikzcdset{arrow style=tikz, diagrams={>=...}}

and fine tune the arrow position, with:

end anchor={[shift={(...,...)}]}

Here is my MWE:

\tikzcdset{arrow style=tikz, diagrams={>=Latex}}% arrow tip

         & b\ar[rr] &  & d\ar[rr] &  & f\\
        ai \ar[ur]\ar[rr]\ar[drr] &  & ci\ar[ur]\ar[rr] &  & edi\ar[ur]\\
         &  & ciii\ar[rru]\ar[rr]\ar[ruu] &  & eiii\ar[uur]\\
        aii\ar[uuur]\ar[urr]\ar[rr] &  & cii\ar[rru]\ar[uuur,end anchor={[shift={(2pt,-1pt)}]} % fine tuning of the arrow position

enter image description here

  • +1 I didn't know that the syntax for arrows was so flexible. – Andrew Oct 31 '17 at 7:05
  • @Andrew Of course it is! ;) – CarLaTeX Oct 31 '17 at 7:07
  • thanks +1, this looks nice. I think it will be compatible to replace each symbol for minipage, yes or no? :-) – wonderich Oct 31 '17 at 13:49
  • @wonderich Do you intend to put a minipage instead of the letters? – CarLaTeX Oct 31 '17 at 14:25

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.