  Spatio-temporal shaping of electron beams is a bold frontier in electron
microscopy, enabling new routes toward spatial-resolution enhancement,
selective probing, low-dose imaging and faster data acquisition. Over the last
decade, shaping methods evolved from passive phase plates to low-speed
electrostatic and magnetostatic displays. Recently, higher shaping speed and
flexibility have become feasible by the advent of ultrafast electron
microscopy, embodying a swift change of paradigm that relies on using light to
control free electrons. Here, we experimentally demonstrate that arbitrary
transverse modulation of electron beams is possible without the need for
designing and fabricating complicated electron-optics elements or material
nanostructures, but rather resorting to shaping light beams reflected from a
planar thin film. We demonstrate arbitrary transverse modulation of electron
wavepackets via inelastic interaction with a shaped ultrafast light field
controlled by an external spatial light modulator (SLM). We illustrate this
method by generating Hermite-Gaussian (HG) electron beams with HG10 and HG01
symmetry and discuss their possible use in enhancing the imaging contrast of
microscopic features. Relative to current schemes, our approach adopting an
external SLM dramatically widens the range of patterns that can be imprinted on
the electron wave function and makes electron shaping a much easier task to
perform.
