I believe that in this context:
Place your feet shoulder-width apart.
it makes sense to hyphenate to avoid confusion. I see that
apart is listed as an adverb in the dictionary and
width as a noun, so it would appear
shoulder is an adjective of the noun
width in this context.
I see this as possibly matching one published rule for hyphenating:
Rule 2b. When writing out new, original, or unusual compound nouns, writers should hyphenate whenever doing so avoids confusion.
Is that correct? However, I feel in this example:
Place your feet apart by a shoulder width.
it should not be hyphenated. Is this correct? What are the rules that apply in these two cases? Are they really the same case?
I do not believe this is a duplicate of the suggested question since I'm asking about the parts of speech of the possibly hyphenated words and which if any of the hyphenation rules applies to this situation, such as the mentioned compound noun rule.