Great thread John thanks for posting.

The box gantry will always be a clear winner from the deflection point of view, but then you have to put the ballscrew somewhere. You can put it on the front face but then you have to step the Z axis away from the gantry, loosing some stiffness benefit. Plenty of commerical CNC routers use this layout and they work just fine. Or you can go for the L shape, tuck the Z axis tight against the gantry and put the ballscrew just behind. Plenty of DIY builders on here have gone this route and that also works just fine.

In general section size is key for stiffness as it goes up with the power ^3 for bending and with the power ^2 for torsion. So a little bit deeper / wider goes along way.

In all cases the material needs to all be furthest away from the neutral axis, the bit somewhere in the middle where not a lot is happening. So tubes are good, squares are better. Avoid open sections such as [ or I beams. They are only good in one direction.

Once you have maxed out on the outer size, have a play with wall thickness as this can really boost the stiffness. The limit is then how much weight you are comfortable with.