Superconductivity in electron-doped layered TiNCl with variable interlayer coupling