In situsmall-angle X-ray scattering was used to identify structural changes during thermal treatment of an ordered mesoporous carbon precursor material, synthesized via direct soft templating, to remove Pluronic F127 surfactant from a resorcinol–formaldehyde frame.