Not sure if you guys are aware of this...I only became aware of it myself quite recently.

BUT:

MTW2 has the ability to remember and maintain any army formation you choose.

To set-up the formation you want just place your units where you want them during the deployment phase, or at any other point during the battle.

Once your troops are in the formaiton your want them to maintain merely press CTRL+A (to select all your units) then Press G (to group the entire army).

Now when you order your army to move all the units will keep their positions relative to each other. Its best when ordering the army to move to pause the game first as it sometimes takes several tries to get the armies destination perfectly lined up where you want to be.

Provided that the Army remains grouped all the units will stay perfectly aligned in their formation (as long as you don't order them to run, as units that can't run, like artillery, get left behind)

Note: Cavalry charges, skirmishers etc.

Some units will inevitably get out of formation during battle, either because you order them to charge or pursue, or because they are in skirmish mode and evade an attack.

However, as long as you keep the Group active the units will always remember their correct position in the formation and return to it when you move the army as a group.

If you wish to modify the formation e.g. to have your archers deploy behind your spearmen instead of in front, all you need to do is move the units where you want them cancel the group and press CTRL+A and G to store the revised army formation.