## Supplementary Information 

Details on the material and methods used for this study are given in the following sections. 

## Appendix A. Experimental measurements 

## Appendix A.1. Experimental setup 

The experimental setup is displayed in Figure 1. Details are given in this section. 

The beam defines the x -axis of the setup. Energies between 80 and 180 MeV were used to place the Bragg peak inside the main magnetic field (as would be the case in a clinical situation of MR-integrated proton therapy). 

In order to reduce the particle fluence on the magnets and the yoke and thus to prevent radiation damage, the beam was collimated by two brass collimators with a circular aperture of 10 mm diameter. The collimators had a cylindrical shape with an outer radius of 9 cm and a combined thickness of 6 . 6 cm. This thickness allows to fully stop peripheral protons for all used energies up to 180 MeV. The distance between the beam exit window and the surface of the first collimator was 1 . 63 m, and that between the two collimators was 2 cm. The large distance between the beam exit and the collimators was chosen to improve the lateral beam homogeneity by increased scattering in air. The collimators were placed in the beam line such that a symmetric beam profile was achieved behind the collimators (see Extended Data, Figure A.8). 

The collimated beam travelled 22 cm through air before it impinged on the phantom, which was placed centrally in the beam’s isocentre inside a transverse magnetic field. The phantom comprised two slabs of polymethyl methacrylate (PMMA) and measured x$_{ph}$ × y$_{ph}$ × z$_{ph}$ = 30 × 15 × 3 cm $^{3}$. The density of the PMMA was (1 . 186 ± 0 . 002)g cm − 3 as measured by density determination scales. The phantom was mounted into the air gap of the magnet assembly by an L-shaped holder. 

In order to measure planar dose distributions in the isocentre plane, a film detector was placed horizon- tally in the phantom. The film was bevelled by α = 1 ◦ to reduce the dependence of the dose distribution on the film material and possible air gaps between phantom and film. An angle of α = 1 ◦ was chosen as it tilted the measurement plane minimally out of the central beam plane whilst suppressing these effects as good as larger angles [19]. With this angle, the inclination lead to differences in x below 0 . 02 mm. However, we note that this tilt makes the resulting depth-dose curves not directly comparable to those which would be obtained with an ionization chamber moving along the central beam axis due to the laterally sloping beam profile. The air gap between the phantom and the film was minimized by four plastic screws pressing the slabs together. 

