  An ability to completely customise the mode profile in an electromagnetic
waveguide would be a useful ability. Currently, the transverse mode profile in
a waveguide might be varied, but this is usually a side effect of design
constraints, or for control of dispersion. In contrast, here we show how to
control the longitudinal (propagation direction) mode profile on a
sub-wavelength scale, but without the need for active solutions such as
synthesizing the shape by combining multiple Fourier harmonics. This is done by
means of a customised permittivity variation that can be calculated either
directly from the desired mode profile, or as inspired by e.g. the range of
shapes generated by the Mathieu functions. For applications such as charged
particle beam dynamics, requiring field profile shaping in free space, we show
that it is possible to achieve this despite the need to cut a channel through
the medium.
