Compounds containing acid anhydride or acid halide groups