# How does LaTeX make line-breaking for word that can not fit in cell?

Often in my tables LaTeX doesn't want to line-break a word that can not fit in a cell.

How I can teach it to split such a word?

As you can see in my example below the same word in some cases will be split, in another cases not.

I want to teach LaTeX to split all words (that can not fit on the page) automatically.

Can you help me?

Some example:

\begin{longtable}{|p{0.1\textwidth} | p{0.3\textwidth}|} \hline
Text                       & Remarks   \\ \hline
new zoogeographical region &           \\ \hline
zoogeographical region     &           \\ \hline
\end{longtable}


The issue seems to be that LaTeX doesn't hyphenate the first word in a paragraph. I don't know if there's a way to enable that globally, but in your case, adding \hspace{0pt} without a space afterwards solves the issue:

\documentclass{article}
\usepackage{longtable}

\begin{document}
\begin{longtable}{|p{0.1\textwidth} | p{0.3\textwidth}|} \hline
Text                       & Remarks   \\ \hline
new zoogeographical region &           \\ \hline
\hspace{0pt}zoogeographical region     &           \\ \hline
\end{longtable}
\end{document}


To automate this process and apply \hspace{0pt} to every cell (in a column) to simplify automated table generation, you can use the >{...} syntax from the array package, which adds ... to the beginning of every cell in the respective column. Here are the lines I had to change/add in comparison to the MWE above.

...
\usepackage{array}
...
\begin{longtable}{|>{\hspace{0pt}}p{0.1\textwidth} | p{0.3\textwidth}|} \hline
...


(The output looks the same.)

• This seems to be a legit solution -- Heiko Oberdiek recommended it: tex.stackexchange.com/a/67764/4012 Oct 18 '12 at 7:35
• I assume this is because the hspace now counts as the first "word" in the paragraph? I am looking at a similar situation, but I don't know beforehand what text is going to go in the table (Data generated through a script). Is there a way to globally change the hyphenation rule to include first words, or do so for the duration of a table? Throwing \hspace{0pt} in front of every single cell seems...ugly.
– Eric
Oct 19 '12 at 16:32
• @Eric I agree, but I don't know. Sounds like a good question to ask here on tex.sx: How can I globally enable hyphenation for the first word in a paragraph? Oct 19 '12 at 18:11
• @Eric You might not need this solution anymore, but I added a way of adding the \hspace{0pt} in front of every cell automatically. Apr 8 '13 at 1:08