Hyphenation when using non breaking space for names like in F.\,Fugmann

I place a small non-breaking space between abbreviated forenames and the surnames, e.g. I write F.\,Fugmann. (A German name.)

I noticed that F.\,Fugmann now doesn't get hyphenated, even when using babel with German hyphenation patterns and putting \hyphenation{Fug-mann} into the preamble.

As this behaviour causes overfull boxes which I currently debug by writing F.\,Fug\-mann, I began to wonder:

1. Is there a way to automatically achieve the behaviour I intend?

2. Is it advisable to hyphenate names like F.\,Fug\-mann at all from a typographical standpoint?

• I'd use F.~Fugmann. A thin space may be used between initials (Bringhurst likes it, I prefer normal spaces), but not between initials and the surname. – egreg Jul 13 '16 at 16:13
• Normally, doesn't one avoid hyphenating family names? – Bernard Jul 13 '16 at 16:40
• @egreg: Using a full space seems to be the convention in English/American typography. For German texts a thin space between initials and the surname seems to be recommended. I'm by no means an expert, but that's what my reference says (Forssman/de Jong, Detailtypografie, 4th Ed. 2008. – FredFisch Jul 13 '16 at 16:51
• @Bernard: It’s better to hyphenate the family name than to have a lonely initial at the end of the line. Hyphenation is a necessary evil (the last four words are a quotation from The TeXbook, too! ;-). – GuM Jul 13 '16 at 16:52
• @Bernard: Maybe, but hyphenating family names is better than having overfull boxes... – FredFisch Jul 13 '16 at 16:52

A trick learned from egreg. If you put \nobreak\hspace{0pt} between the nonbreakable space and the last name, the last name will be reevaluated as its own entity for hyphenation. Below, I codify that as \? to place the small unbreakable space and reset the "hyphenability" of the following word.

\documentclass{article}
\newcommand\?{\,\nobreak\hspace{0pt}}
\textwidth0pt\relax
\begin{document}
\hyphenation{Fug-mann}
Start
Fugmann
F.\,Fugmann
F.\?Fugmann
\end{document}


In a comment, Gustavo adds a pointer to Knuth's explanation on why this works, found on page 454 of the TeXbook:

The key in Knuth's explanation is that "hyphenation is abandoned (until after the next glue item)" if "any other type of item occurs before a suitable starting letter." Therefore, the solution, by adding \hspace{0pt} is adding a "glue item" that restarts the hyphenation search, and the \nobreak prevents a line break from being inserted after the \, and before the last name, which could otherwise happen with a glue item.

• For an explanation, see The TeXbook, p. 454, second “double dangerous bend”. Recall that \, inserts an explicit kern. – GuM Jul 13 '16 at 16:28
• @GustavoMezzetti Thanks for Knuth's words on it. I was aware that the \hspace{}, being breakable, allows what follows to be considered the start of a new word, unlike \kern. – Steven B. Segletes Jul 13 '16 at 16:31
• I had no doubt you knew the full story: I simply thought that readers might benefit from the reference. (:-) – GuM Jul 13 '16 at 16:35
• @GustavoMezzetti Indeed, and I appreciate you bringing that to my own and the readers' attention. – Steven B. Segletes Jul 13 '16 at 16:37

Steven should take full credit; I add some considerations about the problem.

The separator between initials and surname seems to be controversial and you may be requested to use a normal space instead of the thin space.

So it's much better to define a macro that will take care of the issue: just changing its definition will modify the global behavior.

Here the macros; the main one has a *-form: I believe that names should be hyphenated only as a last resort; in case a particular name gives problems, it's easy to change \name{...} into \name*{...}.

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\setupnames}{m}
{
\keys_set:nn { fredfisch/name } { #1 }
}
\NewDocumentCommand{\name}{sm}
{
\IfBooleanTF{#1}
{
\keys_set:nn {fredfisch/name} { hyphen=true }
}
{
\keys_set:nn {fredfisch/name} { hyphen=false }
}
\fredfisch_name:n { #2 }
}

\keys_define:nn { fredfisch/name }
{
hyphen .bool_set:N = \l_fredfisch_name_hyphen_bool,
initials-sep .tl_set:N = \l_fredfisch_name_initials_sep_tl,
surname-sep .tl_set:N = \l_fredfisch_name_surname_sep_tl,
}

\seq_new:N \l_fredfisch_name_initials_seq
\tl_new:N \l_fredfisch_name_surname_tl

\cs_new_protected:Nn \fredfisch_name:n
{
\seq_set_split:Nnn \l_fredfisch_name_initials_seq { . } { #1 }
\seq_pop_right:NN \l_fredfisch_name_initials_seq \l_fredfisch_name_surname_tl
\seq_if_empty:NTF \l_fredfisch_name_initials_seq
{
\mode_if_horizontal:F { \leavevmode }
\kern0pt\nobreak\scan_stop:
}
{
\seq_use:Nn \l_fredfisch_name_initials_seq { . \l_fredfisch_name_initials_sep_tl }
.
\l_fredfisch_name_surname_sep_tl
\nobreak
}
\bool_if:NT \l_fredfisch_name_hyphen_bool { \hspace{0pt} }
\l_fredfisch_name_surname_tl
}

\ExplSyntaxOff

\hyphenation{Fug-mann}

\begin{document}

\setupnames{
initials-sep = {\,},
surname-sep = {\,},
}

\parbox{0pt}{
Start
Fugmann
\name{F. Fugmann}
\name*{F. Fugmann}
\name{P.A.M. Dirac}
}

\bigskip

\setupnames{
initials-sep={\,},
surname-sep={~},
}

\parbox{0pt}{
Start
Fugmann
\name{F. Fugmann}
\name*{F. Fugmann}
\name{P.A.M. Dirac}
}

\bigskip

\setupnames{
initials-sep={~},
surname-sep={~},
}

\parbox{0pt}{
Start
Fugmann
\name{F. Fugmann}
\name*{F. Fugmann}
\name{P.A.M. Dirac}
\name{Fugmann}
\name*{Fugmann}
}

\end{document}


Note that, independently of how you input the initials, they will always be separated by the chosen space.

Some explanations. The argument to \name is split at periods and the last part is taken as the surname. Then the initials are delivered, separated by a period followed by the chosen separator; then the separator between the initials and the surname is inserted (note that it can be different from the separator between initials) along with \nobreak; if the *-variant is used, we also insert \hspace{0pt} that allows hyphenation in the surname.

Typing \name{Fugmann} will disallow hyphenation, but the *-variant will enable it again.

• That is a pretty neat solution! – FredFisch Jul 21 '16 at 16:45