Fix table/figure number issue by replacing complicated code with less complicated code.
Ignoring temp output from pdflatexmk.

How to compile book:

Open main.tex in TeXShop. Switch typesetting type from "LaTeX" to "pdflatexmk". This automatically regenerates bibliography, index, page references, etc.
Auto-revise index.
Fix 2 stale references. (Always remember to skim through main.log to ensure there are no new reference errors.)