As for underground crossbow galleries I tend to make them a bit like modern shooting galleries. I set up something like this:
Target, Wall, Fortification table, Stockpile, Door.
WWWWWWWWWWWWWWWWWWWWW
WT......................................t...FSSSW
WT......................................t...F....SW
WT......................................t...F....SW
WT......................................t...F....SW
WT......................................t...D....SW
WWDWWWWWWWWWWWWWWDWWWW
W....................................................=> to fort.
WWWWWWWWWWWWWWWWWWWWW
I forbid the all the area between the targets up to the tables, so my dwarves end up shooting from behind the tables. The stockpile room generally have a chair and a table in there and sometimes I connect it to my bone bolts production workshop. The stockpiles are set to cheap bone or wooden crossbows and bone bolts. The fortifications latter are replaced by glass panels if possible.
Sometimes I even get fancier and set it up like this:
WWWWWWWWWWWWWWWWWWWWW
WT......................................t...FSSSW
W.......................................W...F....SW
WT......................................t...F....SW
W.......................................W...F....SW
WT......................................t...F....SW
W.......................................W...F....SW
WT......................................t...F....SW
W.......................................W...F....SW
WT......................................t...D....SW
WWDWWWWWWWWWWWWWWDWWWW
W....................................................=> to fort.
WWWWWWWWWWWWWWWWWWWWW
So each table is separated by a "panel", like in shooting gallerias.
For some outside ranges I made them simple, with only targets and a stockpile around for bolts and crossbows. I however always forbid walking in front of the targets, I have this fear that a marksdwarf will lodge a bolt in the head of that cheese maker walking around.