Magnetic compression of completely-immersed electron beams