Stop hyphenation for table column

hyphenationtables

I have this table

\documentclass{article}
\usepackage{tabulary} 
\begin{document}
\begin{table}[htbp]
\begin{tabulary}{\textwidth}{lLLLrr}
\hline
\textbf{type} & \textbf{author} & \textbf{title} & \textbf{about} & \textbf{year} & \textbf{ref} \\ \hline
book & David Salomon and Giovanni Motta & Handbook of Data Compression & general & 2010 & [1] \\
article & Senthil Shanmugasundaram and Robert Lourdusamy & A Comparative Study Of Text Compression Algorithms & text compr. & 2011 & [2] \\
article & Kitty Arora and Manshi Shukla & A Comprehensive Review of Image Compression Techniques & image compr. & 2014 & [3] \\ \hline
\end{tabulary}
\end{table}
\end{document}

This is how it looks like:
enter image description here

I don't want to have hyphenation in the column "about". But I still want to have line breaks where necessary. So, the words "general" and "image" shall not by hyphenated (nor any other word in this column), but there shall be a linebreak between "text" and "compr." as well as between "image" and "compr.".

Hyphenation shall be possible in other columns. I want the name "Shanmugasundaram" to be hyphenated, also long words in the title shall be hyphenated (not shown in my example).

I tried other symbols for columns definition (other than l, L, r), but then the table looks ugly and hyphenation still happens. I also tried {\raggedright general} instead of general, but this has no effect.

What can I do to avoid hyphenation in the column "about"?

Best Answer

You can set the hyphenation penalties \hyphenpenalty and \exhyphenpenalty to an “infinite” value for that particular column as mentioned in the TeX FAQ. However, this causes overlapping in the case of long words (notice the 4th row) which may be prevented by setting a specific width of that column.

\documentclass{article}
\usepackage{tabulary} 
\begin{document}
\begin{table}[htbp]
\begin{tabulary}{\textwidth}{lLL>{\hyphenpenalty=10000\exhyphenpenalty=10000}Lrr}
\hline
\textbf{type} & \textbf{author} & \textbf{title} & \textbf{about} & \textbf{year} & \textbf{ref} \\ \hline
book & David Salomon and Giovanni Motta & Handbook of Data Compression & general & 2010 & [1] \\
article & Senthil Shanmugasundaram and Robert Lourdusamy & A Comparative Study Of Text Compression Algorithms & text compr. & 2011 & [2] \\
article & Kitty Arora and Manshi Shukla & A Comprehensive Review of Image Compression Techniques & image compr. & 2014 & [3] \\
article & Kitty Arora and Manshi Shukla & A Comprehensive Review of Image Compression Techniques & imagefhdfjk compr. & 2014 & [3] \\\hline
\end{tabulary}
\end{table}
\end{document}

enter image description here

Addendum:

You may also use the tabularray package which allows manual linebreak in a cell.

\documentclass{article}
\usepackage{tabularray}

\begin{document}
\begin{table}[htbp]
\begin{tblr}{
    width=\textwidth,
    colspec = {lX[l]X[l, 1.5]lrr},
    row{1} = {font=\bfseries}
}
\hline
type & author & title & about & year & ref \\ \hline
book & David Salomon and Giovanni Motta & Handbook of Data Compression & general & 2010 & [1] \\
article & Senthil Shanmugasundaramasks and Robert Lourdusamy & A Comparative Study Of Text Compression Algorithms & {text\\compr.} & 2011 & [2] \\
article & Kitty Arora and Manshi Shukla & A Comprehensive Review of Image Compression Techniques & {image\\compr.} & 2014 & [3] \\
\hline
\end{tblr}
\end{table}
\end{document}

enter image description here

This package makes handling tables very easy and convenient. Note that there is better spacing between the rows by default.

Related Question