For me all ranged units are at the front no matter the unit. I think it may be because I changed all projectiles in my own modding to have a low trajectory rather than a dual_fixed trajectory, so now they all act like crossbows. I've been messing with every single table that affects battle stats though.. so it's hard to tell exactly what is causing it.
Spoiler Alert, click show to read:
My current project in progress. Ignore what unit types are in the formation, just using whatever composed entities I can get to function right now while testing. Each entry needs to be unique and standard bearers and officers/generals have preset locations in the formation based on their composed entity table. Was trying to get a General in the middle with some bodyguards and standard bearers, a vanguard colonel/bodyguards/standard bearers and a rearguard colonel/bodyguards/standard bearers. Can't get the rearguard one to work (just puts them all up front), but I can get a vanguard colonel and general. From there I have a vanguard of crossbows, several lines of veterans (they show up at the very back right now, trying to put them behind the crossbows), the core of spear, the rearguard of pike. Since I cannot get the rearguard colonel to work I may just put in several bodyguard units of cavalry on the edges of the rear of the formation to act as "rear sergeants" similar to the video Wake posted. I really wanted to get a line of standard bearers at the very back but I can't seem to get it to work.
My hope is that once we can adjust how many units are allowed per army again via ESF/Saveparser I'll be able to increase the unit sizes to a realistic brigade size, have each unit operate as a brigade entity, and have less units on the battle map but far more armies on the campaign map. As it is now I gotta keep the unit sizes down due to performance reasons. Even though I've prevented the AI from blobbing the game still gets finicky when there are more than 20,000 soldiers on screen (though far less so if the entities cannot run..something else I may do).