如何才能防止tabulary
环境连字表头?
也许重新定义\tyformat
,但我找不到对该命令的任何引用。
编辑
根据评论所建议,我尝试:\newcolumntype{}
\documentclass{article}
\usepackage{tabulary}
\begin{document}
\newcolumntype{Y}{>{\raggedright\arraybackslash}J}
\begin{tabulary}{\textwidth}{YYYYY}
\hline
& label 1 with much more text than is needed & label 2 is also very long & label 3 & label 4 \\
\hline
1 & item 1 & item 2 & item 3 & item 4 but again with too much text \\
2 & A & B & C & D \\
\hline
\end{tabulary}
\end{document}
不幸的是,第四列被连字符了,而我只想换行。我看不出普通列类型和{JJJJJ}
自定义列类型有什么区别。
答案1
如果使用,\raggedright
则仅当单词长度超过行宽时,LaTeX 才会进行连字符连接,因此您只需确保不会出现小得可笑的列。我tymin
在这里设置为 1cm。请注意,您不需要Y
为参差不齐的右列进行定义,因为本质上是相同内容的tabulary
预定义。L
\documentclass{article}
\usepackage{tabulary}
\begin{document}
\setlength\tymin{1cm}
\noindent
\begin{tabulary}{\textwidth}{LLLLL}
\hline
& label 1 with much more text than is needed & label 2 is also very long & label 3 & label 4 \\
\hline
1 & item 1 & item 2 & item 3 & item 4 but again with too much text \\
2 & A & B & C & D \\
\hline
\end{tabulary}
\end{document}