# hyphenation: what special is in word "implementation"

What special is in the word "implementation" that it is not possible automatic hyphenate in narrower environments as are minipage, TikZ nodes etc, even if in preamble is added hyphenation pattern for it?

Interestingly, hyphenation works, if in the begins of those environments is added \hspace{0pt}! Examples:

\documentclass{article}
\begin{document}

\textbullet doesn't work:

\smallskip
\fbox{\begin{minipage}{4em}
implementation
\end{minipage}
}

\medskip
\textbullet\ with use of \verb+\hspace*{0pt}+ works:

\fbox{\begin{minipage}{4em}\hspace*{0pt} % <---
implementation
\end{minipage}
}
\end{document}


And example at use TikZ nodes:

    \documentclass{article}
\usepackage{tikz}
\begin{document}

\textbullet\ doesn't work:

\smallskip
\tikz\node[draw, text width=4em, align=center] {implementation};

\textbullet\ with use of \verb+\hspace*{0pt}+ works:

\tikz\node[draw, text width=4em, align=center,
execute at begin node=\hspace*{0pt}] % <---
{implementation};
\end{document}


I wonder, what is in the word implementation. For example, with similar long word hyphenation this problem not occur.

• You mention that implemeantation doesn’t work. Well, this isn’t really surprising, is it. You just misspelled it. (In the code it is correct, though, how do you produce the output?)
– user194703
Jan 25 '20 at 3:49
• I observe this some minutes ago and correct spelling. However, the problem still persist. Jan 25 '20 at 3:51
• Are you compiling the test document with pdfLaTeX, XeLaTeX, or LuaLaTeX? The reason I ask is that (plain) TeX, pdfLaTeX, and XeLaTeX all share the feature that the very first word in a (logical) paragraph never gets hyphenated. Inserting \hspace*{0pt} assures that, syntactically speaking, implemention is no longer the first "word" in the paragraph. Interestingly, LuaLaTeX has no such trouble.
– Mico
Jan 25 '20 at 4:18
• @Mico hyphenating the first word is a documented extension to tex in luatex. Jan 25 '20 at 8:15
• @Cicada \hspace{0pt} is better than \  as the latter would affect the output. Jan 25 '20 at 8:21

There is nothing special about implementation. TeX simply does not hyphenate the first word of a paragraph. If you need this hyphenated you have to have glue before it such as \hspace{0pt}. This (mis)-feature is shared with tex variants such as ptex and xetex, however luatex does include the first word in its hyphenation pass, and so would hyphenate your example without the extra space.

• Thank you very much for your explanation. Now many other things are more clear. However, now I wonder, why Lua has different rules at hyphenation as other TeX engines ... (first +1 was mine ;-) ) Jan 25 '20 at 9:46
• @Zarko because the tex one makes no sense and is just kept for the stability reasons but luatex is explicitly not as tied to classic tex compatibility as other tex variants, luatex hyphenation happens at a different point in the inner loop which means it will choose different hyphenation points in several other cases, not just first word, even though it uses the same hyphenation patterns and algorithm. Jan 25 '20 at 10:01
• @Zarko I'm sorry. :-( Mine is only 8 th for David and the 4th for you). Jan 25 '20 at 13:38
• @Sebastiano, don't worry. For the last few days, I only occasionally look at what's happening on site. Due to flu most of time I'm in bed :-(. Hopefully, better days for voting of my answer will come soon :-). For now is the most important that I learned a lot from David's answer ... Jan 25 '20 at 16:29

Hyphenations are based on line breaks to compose a paragraph. The hyphenation algorithm is probably not used at first.

### The TeXbook, chapter 6: running TeX

[...] a tolerance of 10 000 will never produce an overfull box, unless something strange occurs like an unhyphenatable word that is wider than the column itself.

The following example from the TeXbook shows an overfull box although the log file shows that the word Drofnats can be hyphenated: Drof-.

\tracingparagraphs=1
\tolerance=10000
\hsize=.75in
\hrule
\vskip 1in
\centerline{\bf A SHORT STORY}
\vskip 6pt
\centerline{\sl    by A. U. Thor} % !??! (modified)
\vskip .5cm
Once upon a time, in a distant
galaxy called \"O\"o\c c,
there lived a computer
named R.~J. Drofnats.

Mr.~Drofnats---or R. J.,'' as
he preferred to be called---% error has been fixed!
was happiest when he was at work
typesetting beautiful documents.
\vskip 1in
\hrule
\vfill\eject
\end


By forcing the hyphenation, we obtain a better rendering.

hfuzz=10pt  %->line 3
Mr~Drof\-\penalty10000nats %->line 16

• Thank you very much for TeX example. I mostly stick with pdfLaTeX, experimenting with XeLatEX and now start to look in LuaLaTeX. Hopefully you answer would be of interest of pure TeX user (+1) Jan 25 '20 at 21:21