Formation of titanium nitride layers from a gaseous phase with the participation of a chemical reaction