I have been transcribing an old, public-domain novel and am attempting to typeset it using Latex as close as I can to the original formatting of the book. I've taken Memoir template and am modifying it to this end but I'm not much of a Latex expert. One feature on the novel is the common use of em dashes for asides without any spaces between the words preceding or proceeding the dash, like so:
When I typeset this (just using the em dash character "—" itself in the files) it caused Latex to treat "neighbours—namely" as one big word that it wouldn't break up, causing lines to run into the margin a lot. To solve this I used the \discretionary command to to allow these to be broken up (based on this answer) like so:
\let\emdash\textemdash \renewcommand{\textemdash}{\discretionary{\emdash}{}{\emdash}} This has mostly worked but I have found that when it is applied Latex will only break at the em dashes for these cases, it will not break up the individual words even when that would make more sense. For example:
I have a hyphenation rule set up for the word Drumglass.
\hyphenation{Drum-glass}
And I would expect this line to be broken up like so:
“So the old man is still bent upon being lord of Drum- glass—monarch of all he surveys—or rather[...] Rather than running into the margin.
Is there a way to tell Latex to both allow it to break at an em dash but also that it is still fine to hyphenate the individual words if the line is stilling running into the margin after it does that?
Edit: As David Carlisle suggested in the comments I replaced the discretionary command with the following instead:
\let\emdash\textemdash \renewcommand{\textemdash}{\nolinebreak\hspace{0pt}\emdash\hspace{0pt}} 

\nolinebreak\hspace{0pt}\textemdash\hspace{0pt}then it will be two separate words for hyphenation.