When it comes to following grammatical rules by example, the field is a minefield, because many publishers and publications can’t even seem to get it right, and writers must resort to hunting down the correct usage in a style guide or a writing handbook.
Take, for instance, phrases of several words in which hyphenation seems to be called for. Is it “word of mouth,” or “word-of-mouth”? Do you write “on the spot,” or “on-the-spot”? The quick-and-easy answer is, for these and most other apparent word chains, break those chains: No hyphens are necessary — unless the phrase precedes a noun: “I rely on word-of-mouth communication”; “She made an on-the-spot assessment.”
But the game changes for a special class of phrase that, for lack of standard nomenclature, we can call anatomical association:
When your dorsal side is opposite someone else’s, you’re standing back-to-back, and when you confront someone, you go head-to-head. This type of phrase is sometimes hyphenated in adverbial form (used in conjunction with a verb) as well as in adjectival form (preceding or following a noun): “He produced back-to-back hits throughout the decade.” “She hoped to a avoid a head-to-head confrontation.”
Unfortunately, though, even that classification is inconsistent: When you line up among a row of people to your left and right, you’re positioned side by side, not side-by-side. (Though you still hyphenate the adjectival form — you stand in a side-by-side formation.) You can live a hand-to-mouth existence, but you’re living hand to mouth, not hand-to-mouth.
Some similar phrases, such as “head to toe” or “hand in hand,” aren’t even in the dictionary, so the same rule applies; leave open in adverbial form, and hyphenate as an adjective. (Phrasal adjectives usually remain open after a noun, but these aren’t conducive to that syntax anyway.)
This maddening inconsistency leaves us where we started: When in doubt, look it up.
And what about even longer word strings? You can write that someone has a devil-may-care attitude, and that someone has a not-in-my-backyard mentality, but where do you draw the line and stop drawing that little line we call a hyphen? What if someone has a do-unto-others-before-someone-does-unto-you approach to life?
Many such phrases are enclosed in quotation marks rather than hyphenated, which is reasonable for something that would conceivably be uttered — and doesn’t play havoc with narrow columns of type (as it may very well have done here). But phrases of manageable length like “not in my backyard,” even though they’re hypothetical statements, should remain in phrasal-adjective mode.