5

In this example, why is the hyphenation rule not used?

\documentclass{article}
\usepackage{tabu}
\hyphenation{abc-def-hij-klm-nop-qrs-tuv-wxyz}
\begin{document}

\begin{center}
\begin{tabu} {|X|X|}
abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz & 
abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz 
\\
5 & 6 \\
\end{tabu}
\end{center}

\end{document}

Output:

screenshot

1
  • 4
    Your \hyphenation{...} is missing the letter g
    – Lev Bishop
    Aug 19 '12 at 4:59
14
  1. As Lev Bishop already said, the words are different, g is missing in the alphabet word in \hyphenation.

  2. If the text width is decreased, the first word is not hyphenated because TeX does not hyphenate the first word in a paragraph. Adding \hspace{0pt} helps here:

    \documentclass{article}
    \usepackage{tabu}
    \hyphenation{abc-def-ghij-klm-nop-qrs-tuv-wxyz}% g is added
    
    \setlength{\textwidth}{.5\textwidth}
    
    \begin{document}
    
    \begin{center}
    \begin{tabu} {|X|X|}
    \hspace{0pt}abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz &
    abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz
    \\
    5 & 6 \\
    \end{tabu}
    \end{center}
    
    \end{document}
    

    Comparison hyphenation of first word

Not the answer you're looking for? Browse other questions tagged or ask your own question.