I had the same problem. I use hyphenat plus the following macro:
\RequirePackage{hyphenat}
\RequirePackage{expl3}
% The following defs make sure words that contain an explicit `-` (hyphen) are still hyphenated the normal way, and double- and triple hyphens keep working the way they should. Just don't use a `-` as the last token of your document. Also note that `-` is now a macro that is not fully expandable
\ExplSyntaxOn
% latex2e doesn't like commands starting with 'end', apparently expl3 doesn't have any problems with it
\cs_new:Npn \hyphenfix_emdash:c {---}
\cs_new:Npn \hyphenfix_endash:c {--}
\cs_new:Npn \hyphenfix_discardnext:NN #1#2{#1}
\catcode`\-=\active
\cs_new_protected:Npn -{
\futurelet\hyphenfix_nexttok\hyphenfix_i:w
}
\cs_new:Npn \hyphenfix_i:w {
\cs_if_eq:NNTF{\hyphenfix_nexttok}{-}{
%discard the next `-` token
\hyphenfix_discardnext:NN{\futurelet\hyphenfix_nexttok\hyphenfix_ii:w}
}{
% from package hyphenat
\hyp
}
}
\cs_new:Npn \hyphenfix_ii:w {
\cs_if_eq:NNTF{\hyphenfix_nexttok}{-}{
\hyphenfix_discardnext:NN{\hyphenfix_emdash:c}
}{
\hyphenfix_endash:c
}
}
\ExplSyntaxOff
Note that this uses the expl3 package from latex3.
It makes the -
an active character that scans forward to see if it is followed by more dashes. If so, it stays a -
, to make sure --
and ---
keep working. If not, it becomes the \hyp
command from hyphenat, enabling word breaks in the rest of the word. This is a generic solution that makes all words that contain explicit hyphens hyphenate normally.
Note that -
becomes a macro that is not fully expandable, so try to include this after loading other packages that may not expect -
to be a macro
Edit: This is my second version, the first version was less robust when a {
or }
followed a hyphen. This one is not, but unlike the first version the -
in this version is not fully expandable.
Edit 2: My module for fixing this ended up growing into the following. As I no longer use Latex and it was over 10 years ago that I wrote this, I have no idea if the following still works. Caveat emptor!
\RequirePackage{hyphenat}
\RequirePackage{expl3}
% The following defs make sure words that contain an explicit `-` (hyphen) are still hyphenated the normal way, and double- and triple hyphens keep working the way they should. Just don't use a `-` as the last token of your document. Also note that `-` is now a macro that is not fully expandable
% The original hyphen is available as the \hp command.
\ExplSyntaxOn
\cs_new:Npn \hp {-}
% make hyphen the normal character
\cs_new:Npn \hyphenfixdisabled {
\catcode`\-=12\relax
}
\cs_new:Npn \hyphenfix_emdash:c {---}
\cs_new:Npn \hyphenfix_endash:c {--}
\cs_new:Npn \hyphenfix_discardnext:NN #1#2{#1}
\cs_new:Npn \hyphenfix_ignore:c {-}
\catcode`\-=\active
%Making hyphen an active character throughout a document can lead to unexpected errors, especially if it is being edited by multiple persons. This note command at the beginning of what will be the meaning of `-' will hopefully help diagnose errors resulting from hyphen behaving unexpectedly.
\catcode`\!=11
\catcode`\.=11
\let \Note:hyphen_is_an_active_character!_see_hyphenfix.tex! \relax
\cs_new_protected:Npn \hyphenfix_fixhyphen:w{
\if_mode_math:
\hp
\else: \use_i_after_fi:nw {
\Note:hyphen_is_an_active_character!_see_hyphenfix.tex!
\futurelet\hyphenfix_nexttok\hyphenfix_i:w
}
\fi:
}
\catcode`\!=12
\catcode`\.=12
\cs_new:Npn \hyphenfix_i:w {
\cs_if_eq:NNTF{\hyphenfix_nexttok}{-}{
%discard the next `-` token
\hyphenfix_discardnext:NN{\futurelet\hyphenfix_nexttok\hyphenfix_ii:w}
}{
% from package hyphenat
\hyp
}
}
\cs_new:Npn \hyphenfix_ii:w {
\cs_if_eq:NNTF{\hyphenfix_nexttok}{-}{
\hyphenfix_discardnext:NN{\hyphenfix_emdash:c}
}{
\hyphenfix_endash:c
}
}
\cs_new:Npn \hyphenfixenable {
\catcode`\-=\active
\let-\hyphenfix_fixhyphen:w
}
\cs_new:Npn \hyphenfixdisable {
\let-\hyphenfix_ignore:c
\catcode`\-=12\relax
}
\catcode`\-=12\relax
\ExplSyntaxOff