举个例子就足以说明问题:
\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}
这里,只有第一个会发出警告tabulary
。它说Package tabulary Warning: No suitable columns
。是否发生取决于单元格的内容,但我真的不明白在什么情况下会发生。
为什么会出现此警告?这似乎是其中的一个错误,fontenc
因此tabulary
应该予以纠正。
笔记:尽管只是警告,它会改变表格的显示。请参阅此主题。编辑:其实不是。这个问题无关紧要。
答案1
问题似乎在于,欧洲现代字体的 em 比计算机现代字体稍微细一些。
如果我加载tabulary
该debugshow
选项,我会得到
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
第一次没有加载tabulary
时。相反,我得到T1
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
何时T1
加载。
如果我添加
\AtBeginDocument{\setlength{\tymin}{1em}}
文档序言中,诊断是
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
从而避免了警告。
答案2
该列比默认\tymin
的要窄。设置为较小的值以避免出现警告:10pt
\tymin
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{tabulary}
\begin{document}
\setlength{\tymin}{5pt}
\begin{tabulary}{\textwidth}{C}aa\end{tabulary}
\end{document}