我正在尝试在乳胶中创建自我调节表。这将是一个大表,因此如果空间不足,我需要文本才能转到下一行,但是我无法做到这一点。我需要有5列。 下面是我所管理的图像,但是“描述”现在进入下一个单元格。如果有人可以告诉我我要去哪里错了,我将不胜感激。我花了很多时间
我正在使用的代码
\begin{table}[h]
\begin{tabularx}{\textwidth}{|l|X|X|X|X|}
\hline
Author & Clustering Technique & Dataset & Description & Industry\\
\hline
\citeauthor{shen2009study} & Quantiles & Customer and Transaction Department store & RFM; Customer Lifetime Value; Target Marketing; Data Mining
& Retail Store \\
\hline
\citeauthor{aggelis2005customer} & Quantiles & E-Banking Dataset & Data Mining; e-banking; RFM analysis & Banking\\
\hline
\end{tabularx}
\end{table}
编辑:我也需要它可以放在一页上,或者可以在下一页上继续。
答案 0 :(得分:0)
非常迟到的答案...
为了调整列的宽度,我使用了p{.1\textwidth}
,这是段落对齐,列的宽度等于文本正文宽度的0.1
倍(或其他部分)。
为了让表格在下一页继续,如有必要,我使用了 package with the same name 中出色的环境 longtable
。
\documentclass{article}
\usepackage{longtable,natbib}
\begin{document}
\begin{longtable}{|p{.1\textwidth}|p{.15\textwidth}|p{.25\textwidth}|p{.3\textwidth}|p{.15\textwidth}|}
%\caption[Short caption]{Full caption}\label{longt}\\
\hline
% content of first header
Author & Clustering Technique & Dataset & Description & Industry\\
\hline
\endfirsthead
% content of following headers if the table continues in other page(s)
Author & Clustering Technique & Dataset & Description & Industry\\
\hline
\endhead
% content of all footers
\hline
\endfoot
% content of last footer
\hline
\endlastfoot
\citeauthor{shen2009study} & Quantiles & Customer and Transaction Department store & RFM; Customer Lifetime Value; Target Marketing; Data Mining & Retail Store\\
\hline
\citeauthor{aggelis2005customer} & Quantiles & E-Banking Dataset & Data Mining; e-banking; RFM analysis & Banking\\
\end{longtable}
\end{document}
上面代码的输出:
答案 1 :(得分:0)
为避免侵入下一个单元格,您可以通过为 description
建议可能的连字符点来帮助 Latex
\documentclass{book}
\usepackage{tabularx}
\begin{document}
\begin{table}[h]
\begin{tabularx}{\textwidth}{|l|X|X|X|X|}
\hline
Author & Clustering Technique & Dataset & De\-scrip\-tion & Industry\\
\hline
xxx & Quantiles & Customer and Transaction Department store & RFM; Customer Lifetime Value; Target Marketing; Data Mining
& Retail Store \\
\hline
xxxxxx xxx xxxx xxxxxx xxx & Quantiles & E-Banking Dataset & Data Mining; e-banking; RFM analysis & Banking\\
\hline
\end{tabularx}
\end{table}
\end{document}
(如果您需要表格允许分页,请改用 xltabular
包)