The B12 theory is interesting. I've taken supplemental b12, but never noticed any effect on nail biting. Might have to experiment.
It helps me, a lot, to have clippers and files pretty much everywhere. Office drawer, box on the end table by the couch, bedside table, and at least 6 others wandering around the house. When I realize I'm biting (usually b/c I bit to the quick or tore the cuticle) I grab the clippers and trim them all up. It helps satisfy whatever weird need makes me want my nails to be even and usually curtails the nibbling.
When it was really bad, I would dab some rosemary essential oil under my nails. Under, because that way food I touched didn't always taste like bitter rosemary, but I'd still get that overwhelming bitter taste if I bit. Rosemary extract is, after all, what's in the BitterApple and no-bite stuff for dogs and cats