     for ix in [0...12]
       pitch_number = (ix * 5 + 7) % 12
       fingering = pitch_fingers[pitch_number]
-      string = fingering[0]
-      fret = fingering[1]
+      root_string = fingering[0]
+      root_fret = fingering[1]
       draw_cell ->
         ctx.font = '20px Impact'
         ctx.font = '5pt Times' if draw_diagrams
         ctx.fillStyle = 'rgb(10,20,30)'
         ctx.fillText note_names[pitch_number] + ' ' + title, h_gutter, -3
-        draw_fingerboard()
-        for semitones, si in outervals
-          continue if semitones in intervals
-          draw_intervals_from semitones, string, fret, other_colors[si]
+        fingerings = []
+        # for semitones, si in outervals
+        #   continue if semitones in intervals
+        #   draw_intervals_from semitones, string, fret, other_colors[si]
         for semitones, si in intervals
-          draw_intervals_from semitones, string, fret, colors[si]
+          for {string, fret} in intervals_from(root_string, root_fret, semitones)
+            fingerings.push string: string, fret: fret, color: colors[si]
+        draw_fingerboard fingerings
 
 # chord_page 'Major', [0, 4, 7]
 


chord_book = ->
  chords = [
    ['Major', [0, 4, 7], [0, 3, 7]],
    ['Minor', [0, 3, 7], [0, 4, 7]],
    ['Aug', [0, 4, 8], [0, 4, 7]],
    ['Dim', [0, 3, 6], [0, 3, 7]],
    ['7th', [0, 4, 7, 10]],
    ['Maj7', [0, 4, 7, 11]],
    ['Sus2', [0, 2, 7], [0, 4, 7]],
    ['Sus4', [0, 5, 7], [0, 4, 7]],
    ['Min7', [0, 3, 7, 10], [0, 4, 7, 10]],
    ['Dim7', [0, 3, 6, 9]],
    ['6th', [0, 4, 7, 9]],
  ]
  book "Combined Fretboard Chords.pdf", (pager) ->
    for chord in chords
      pager -> chord_page chord[0], chord[1], chord[2], true

chord_book()

  stream.on 'data', (chunk) -> out.write(chunk)
  stream.on 'end', () -> console.log "Saved #{fname}"

intervals_from = (root_string, root_fret, semitones) ->
  root_note_number = note_number_at(root_string, root_fret)
  fingerings = []
  for string in strings
    for fret in frets
      continue if string == root_string and fret == root_fret
      continue unless (note_number_at(string, fret) - root_note_number + 120) % 12 == semitones
      fingerings.push string: string, fret: fret
  return fingerings

draw_intervals_from = (semitones, root_string, root_fret, color) ->
  root_note_number = note_number_at(root_string, root_fret)
  draw_note root_string, root_fret, true, color
  for {string, fret} in intervals_from(root_string, root_fret, semitones)
    draw_note string, fret, false, color

interval_cards = ->
  fingerings_each (string, fret) ->
