  Nonlinear optical responses are becoming increasingly relevant for
characterizing the symmetries and quantum geometry of electronic phases in
materials. Here, we develop an expanded diagrammatic scheme for calculating
spatially dispersive corrections to nonlinear optical conductivities, which we
expect to enhance or even dominate even-order responses in materials of recent
interest. Building upon previous work that enforces gauge invariance of
spatially uniform nonlinear optical responses, we review the cancellation of
diagrams required to ensure the equivalence between velocity gauge and length
gauge formulations, and provide a simple vertex rule for extending optical
responses to first order in the light wave vector q. We then demonstrate the
method with calculations on a prototypical centrosymmetric model where spatial
dispersion admits anomalous secondharmonic generation, a response that is
symmetry-forbidden under the dipole approximation.
