# How to make ~ work for en-dashes?

I have a German LaTeX-document that tries to implement German en-dash line-breaking rules with ~ like this:

\documentclass[twocolumn,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{german}
\usepackage{yfonts}
\begin{document}
\fraklines\frakfamily\noindent
Bestimmtes: von ihm gewu"st h"atten. Wir waren freilich --~die einzige
Neugierde, die uns: erf"ullte~-- immer bestrebt,
\end{document}


Apparently, LaTeX seems to ignore the ~ after freilich. In the PDF-output (linked above) on page 4 near the end of the left column, you can clearly see a line-break between freulich – and die einzige. Is there a way to fix this issue?

I am using the german package and the Koma script with the scrartcl class.

-
Do not use german, use package babel with the option german (or rather ngerman). – Johannes_B Aug 6 '14 at 13:17
@Johannes_B I thought german was an alias for babel with the german option? – FUZxxl Aug 6 '14 at 13:19
Hi there, I've completed the snippet to a MWE such that people can directly copy paste your example and try it out. Please prefer doing so for the future questions. – percusse Aug 6 '14 at 13:19
@percusse Thank you for your help. I was already making a MWE while you edited the code, I shortened it even further to show only the relevant things. – FUZxxl Aug 6 '14 at 13:21
logically, the line break after freilich seems correct -- the en-dashes here are acting like parentheses, with a beginning and an end. not what an english speaker/writer is used to seeing, but logical nonetheless. this is a matter for someone knowledgeable about german typographic traditions, and thus perhaps off topic. – barbara beeton Aug 6 '14 at 13:22

converting the example in the original question to plain tex demonstrates that plain tex tries a lot harder to avoid a break after the en-dash. here's my test.

\hsize=3.615in
%\hsize=3.62in
%\hsize=3.63in

\noindent
Bestimmtes: von ihm gewu\ss t h\"atten. Wir waren freilich --~die einzige
Neugierde, die uns: erf\"ullte~-- immer bestrebt,

\bigskip

\noindent
Bestimmtes: von ihm gewu\ss t h\"atten. Wir waren freilich \hbox{--}~die einzige
Neugierde, die uns: erf\"ullte~-- immer bestrebt,

\bye


with \hsize at 3.615in, the break is after freilich.

at 3.62in, tex gives up, and in the case without the \hbox, does break after the first en-dash.

at 3.63in, there's enough space on the first line for die, so the break follows that.

so the application of the penalty where ~ follows a hyphen (or multiples, as for en-dash) is not absolute, but much more loosely observed with latex. (why the break occurs with plain tex requires more digging, but i haven't time just now to do that.)

moral of story: if it's absolutely required that there never be a break following an en-dash, pack it in a box before the ~.

-
I defined a macro \newcommand\gs{\mbox{--}\xspace} and substituted it for --. Works like a charm! – FUZxxl Aug 6 '14 at 15:09