To get the basics out of the way:
Getting marksdwarfs to practise archery is mostly a question of getting the setup right. Both active and inactive squads can practise, if they completely fail to do so under either setting means there's something wrong with the way they were set up.
In either case, the absolute minimal requirements are a proper ranged weapon and quiver, properly assigned ammunition (equipment in the military screens) and archery targets enabled for them to 't'rain there.
On top of that, inactive squads don't really need anything apart from a bit of spare time. Archery practise is just another 'job' they can do and it needs to be picked instead of a normal civilian job. Notably, inactive squads _don't_ need a barracks, and having one even tends to be counterproductive, because squad members might end up going there to do 'individual combat drill', training melee (if they have any) or defensive skills (typically dodging, it seems). Neither of which helps with building a capable citizen militia centred around stopgap self-defence and filling the air with bolts through massed deployment.
Active squads also need a barracks to work properly. This enables various defensive-skill drills and demonstrations, which tend to make the archers more survivable when faced with enemies but can also soak up a lot of time, so it may sometimes look like they don't practise archery. Given enough time to get past the demonstration bump, they'll typically end up shooting at the targets constantly, levelling up very quickly and burning humongous amounts of ammo in the process.
My assessment is - inactive training to get decent skill for large numbers of dwarfs without taking them out of the workforce, meaning a large number of the civilian population can react somewhat effectively to threats. Next to no supervision required, ammo consumption is fairly moderate compared to the number of dwarfs trained.
- active training to level-up dedicated ranged soldiers who stay on duty almost constantly; once they're levelled enough, they only need to shoot at targets to keep their skill up, and one or two targets for a whole squad should easily suffice for that. In the training process, the ammo consumption is enormous and because they're on active duty, keeping an eye on their happiness is prudent.
- i found that an active training squad only needs to _have_ a barracks; it's not necessary that the barracks overlaps the archery targets, but i'd recommend it. The barracks is the nexus of training activities; to 'organise' their schedule, squad members first go to the barracks. If they then decide to go to archery practice, having the archery range in the same room cuts down on pointless walking around. They'll be doing more than enough of that already.
Additional not-really-important stuff in spoilers below.
non-archery skills and active training:
Other skills interfere with archery practice: the same as for melee squads really - the more non-essential skills present in a squad, the more time wasted on demonstrations. In the case of shield, dodging and armour, that can be quite helpful for a pure ranged squad, wrestling and combat skills tend to be a lot less useful.
Archers with nothing better to do engage in drills: when there aren't enough targets for everyone or when schedule organisation hiccups, archers may perform 'individual combat drill'. I'm not sure what exactly this does, it appears to default to improving dodging skill. If they only have their crossbows as weapons, it seems that they won't train hammerdwarf or wrestling.
mixed archery/melee squads; specifically tested the combination of marksdwarf with hammerdwarf
I threw a random no-skills recruit into my four-elites marksdwarf squad and equipped him as a hammerdwarf, for obvious reasons. He trained up through individual combat drills only, which meant it went painfully slowly, less than one level per year.
Once he had actual skill, he started giving hammer and fighting demonstrations to his squadmates. Only marksdwarfs who had already gained experience in hammerdwarf/fighter took part in the demonstrations. One of them had never bashed anything with her crossbow and so _never participated_. When i finally broke the squad by issuing them all warhammers, she still had no listed skill in those disciplines, i.e. not even 'dabbling', while the others (all started at 'dabbling') ranged from competent to proficient.
The archers kept shooting at targets and never stopped, even with a lot of messing around later on. Mixed squads are possible and will train properly, although this doesn't imply anything about their practical usefulness. VerdantSF has tried out actually using them in combat and seems to be satisfied with their performance.
archery squads and sparring
Crossbows don't enable sparring. It looks like wrestling skill isn't sufficient, either. The crossbowdwarfs had novice+ hammer skills for years and spent a year or two with all archery targets disabled. They never started a sparring session. I made a half-hearted check for wrestling, too - i.e. they all had adequate wrestler skill and crossbows and didn't spar with that either, they all performed 'individual combat drill' again. I stopped that test after a single season, so i'm not 100% certain, only 98%. Once i gave them their hammers back, their first sparring session took less than a month to occur.
Secondary weapons can enable sparring. I issued war hammers as second weapon to every marksdwarf and they started sparring. Most but not all weapon attacks in sparring were bashes with the crossbow. The squad soon gained additional defensive skills and promptly started to waste inordinate amounts of time on demonstrations. The upshot was that they ended up with adequate to proficient organiser and teacher/student skills.
The same squad can spar and shoot. I enabled two of the archery targets again, and soon saw both archery practice and sparring. I didn't play with the equipment setups but suspect the crossbow must be listed first to allow shooting.
trivia:
Adamantine blunt weapons can kill. Just for laughs, i used a fort-born dwarf as hammerdwarf recruit, in the unpatched game, and equipped him with a masterwork adamantine warhammer. Surprisingly, he scored a few kills on beastmen, three by brainbashing unconscious victims with his styrofoam hammer; it may be that the low weight of the weapon neutralised the size disadvantage, but it's still astonishing that such a weapon could actually kill anything.