Metal-to-insulator transition in oxide semimetals by anion doping