[texhax] Disable hyphenation after - everywhere

Aleksandar Zec zealeksanman at gmail.com
Sat Sep 2 21:02:50 CEST 2017


On 2 September 2017 at 18:45, David Carlisle <d.p.carlisle at gmail.com> wrote:
> probably the easiest way is to keep U+002D (HYPHEN-MINUS) as the
> hyphenchar  but use U+2010 (HYPHEN) for your explicit hyphens and then
> set things up so that is a normal character and remove the
> substitution that make it act like U+002D.
>
> Then you could use U+2010 in patterns or \hyphenation exceptions like a letter.

Hm, interesting idea, thank you.

To simplify it before I try any global solution, if I define a command like this

\newcommand{\nhyp}{\char"2010}

and use it like this

antidisestablish\nhyp{}mentarianism

I will not break anything? I'm asking this after inspecting the code
from hyphenat.sty:

\newcommand{\prw at zbreak}{\nobreak\hskip\z at skip}
\newcommand{\BreakableHyphen}{\leavevmode%
  \prw at zbreak-\discretionary{}{}{}\prw at zbreak}
\DeclareRobustCommand{\hyp}{%
  \ifmmode-\else\BreakableHyphen\fi}

The command \hyp{} allows hyphenation after and at "-". So if I
redefine it using your idea like this:

\newcommand{\prw at zbreak}{\nobreak\hskip\z at skip}
\newcommand{\NonBreakableHyphen}{\leavevmode%
  \char"2010}
\DeclareRobustCommand{\hyp}{%
  \ifmmode-\else\NoBreakableHyphen\fi}

does it have any advances over the above simple \nhyp{}?

Alex


More information about the texhax mailing list