Is the em dash used in formal writing?
Solution 1:
Em dashes can be used if allowed by your style guide (but don't use them too often). For example, this is what APA says:
First, when would you use an em dash? The Publication Manual (p. 97) notes that em dashes are “used to set off an element added to amplify or to digress from the main clause.” The em dash draws a reader’s attention, partly because of the physical separation that the longer dash creates and partly because these dashes appear less frequently than hyphens and en dashes. The novelty of the em dash makes it perfect for text that you want to stand out.
An em dash might set off a phrase at the end of a sentence—like this one. Or, em dashes may set off a phrase midsentence—a technique that really draws a reader’s attention—as they do in this sentence. The text between the dashes is typically a digression or outright interruption of the main idea of the sentence. When used with care, this technique can really punctuate your point (pun intended)!
But “overuse,” notes the Publication Manual (p. 90), “weakens the flow of material.” One sentence with a phrase set off by em dashes draws the reader’s attention; but frequent interruptions of this type risk making your text seem disjointed or cumbersome.
APA Blog: Computer Editing Tip: Em Dashes
In contrast, there are also sources that advise against using the em dash in formal texts:
[E]m dashes should be avoided in formal technical information if you want your tone to be neutral and direct. Because the em dash draws attention to the content that it sets off so strongly, it adds a level of informality to the text.
If you write less formal information, such as marketing information, you can use em dashes for emphasis.
Developing Quality Technical Information: A Handbook for Writers and Editors
Solution 2:
Most authors are uninterested in such details. and wouldn't notice the difference if their paycheques depended on it.
Typographers need to know which dashes to use, but only for consistency.
Sub-editors are there to interpret between the two groups.
Sadly all of that is traditional and theoretical and given that today, Joe Author can send almost anything straight to print with no interference - for which traditionally read help, assistance or correction - from anyone else, every such Question is increasingly meaningless.