A graded selection of hydrogen bonds and halogen bonds allows for the isolation of 2 : 1 : 1 ternary cocrystals of the general form 4-nitrobenzamide : diacid : 1,4-dihalogenated benzene, which are mediated by the amide-acid and I···O2N supramolecular synthons.