Tables – Fixing Font Encoding Warnings in Tabulary with \usepackage[T1]{fontenc}

font-encodingstablestabulary

An example will speak for itself:

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage{tabulary}

\begin{document}

\begin{tabular}{c}aa\end{tabular}
\begin{tabulary}{\textwidth}{C}aa\end{tabulary}
\begin{tabulary}{\textwidth}{C}bb\end{tabulary}

\end{document}

Here, a warning is raised by only the first tabulary. It says Package tabulary Warning: No suitable columns. Whether it happens depends on the content of the cell, but I could not really understand in what case.

Why does this warning appear? It seems like a bug in either fontenc or tabulary so it should be corrected.

Note: Even though it is just a warning, it alters the display of tables. See this thread. Edit: Actually not. The problem was unrelated.

Best Answer

The problem seems to be in the fact that the European Modern font have a slightly thinner em than Computer Modern.

If I load tabulary with the debugshow option, I get

Table
Target Width: 345.0pt
\tabcolsep: 6.0pt \arrayrulewidth: 0.4pt \doublerulesep: 2.0pt
\tymin: 10.0pt \tymax: 690.0pt
Col 1: Initial=22.00003pt         -12.0pt  Final=10.00003pt  > tymin

Line Width: 333.0pt, Natural Width: 10.00003pt, Ratio: 1
10.00003pt,  
Total:10.00003pt

for the first tabulary when T1 is not loaded. Conversely, I get

Table
Target Width: 345.0pt
\tabcolsep: 6.0pt \arrayrulewidth: 0.4pt \doublerulesep: 2.0pt
\tymin: 10.0pt \tymax: 690.0pt
Col 1: Initial=21.99756pt         -12.0pt  Final=9.99756pt  < tymin

Package tabulary Warning: No suitable columns! on input line 10.


Line Width: 323.00244pt, Natural Width: 0.0pt, Ratio: 1
9.99756pt,  
Total:0.0pt

when T1 is loaded.

If I add

\AtBeginDocument{\setlength{\tymin}{1em}}

to the document preamble, the diagnostic is

Table
Target Width: 345.0pt
\tabcolsep: 6.0pt \arrayrulewidth: 0.4pt \doublerulesep: 2.0pt
\tymin: 9.99756pt \tymax: 690.0pt
Col 1: Initial=21.99756pt         -12.0pt  Final=9.99756pt  > tymin

Line Width: 333.0pt, Natural Width: 9.99756pt, Ratio: 1
9.99756pt,  
Total:9.99756pt

that avoids the warning.