wiht the _- and =+ keys you can alter formation depth. so if you select (example) all you infantry, group em and click singe line. you will now have gaps. press _- or += or enlarge or remove the gaps.

PS this does NOT work with units IN phalanx