![将所有文本添加到表格的一个单元格中,并能够看到其他列](https://linux22.com/image/388410/%E5%B0%86%E6%89%80%E6%9C%89%E6%96%87%E6%9C%AC%E6%B7%BB%E5%8A%A0%E5%88%B0%E8%A1%A8%E6%A0%BC%E7%9A%84%E4%B8%80%E4%B8%AA%E5%8D%95%E5%85%83%E6%A0%BC%E4%B8%AD%EF%BC%8C%E5%B9%B6%E8%83%BD%E5%A4%9F%E7%9C%8B%E5%88%B0%E5%85%B6%E4%BB%96%E5%88%97.png)
我想要一个有三列的表格。第一列有长文本,其他列有短文本。我正在使用以下代码:但第一列中的文本无法看清,其他列消失如图所示。请帮助我。谢谢
\tabcolsep=0.11cm
\begin{table*}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\caption{SegNet Performance with Different Optimizers.}
\centering
\begin{tabular}{|c|c|c|}\hline
\tabincell{c}{Text Message} & \tabincell{c}{Video Number} & \tabincell{c}{State}\\\hline
part of the Semantic feature have proved to be a very good
feature if the little effort in making paraphrases in the corpus
can be done. & \tabincell{c}{74} & \tabincell{c}{craving}\\\hline
Computer Science is a specialized domain, and so any or-
dinary paraphrases generation cannot be easily used here
unless there is a human effort be involving in marking the
words that can be permuted from the original to form true or
accurate paraphrases & \tabincell{c}{0.8219} & \tabincell{c}{0.8014} \\\hline
\end{tabular}
\vspace{0.25 cm}
\label{tab2.Spec}
\end{table*}
答案1
使用tabularx
并将第一列标题设置为X
。
\documentclass{article}
\usepackage{amsmath,tabularx}
\begin{document}
\tabcolsep=0.11cm
\begin{table}
\centering
\caption{SegNet Performance with Different Optimizers.}
\smallskip
\begin{tabularx}{\textwidth}{|X|c|c|}\hline
Text Message & Video Number & State \\ \hline
part of the Semantic feature have proved to be a very good
feature if the little effort in making paraphrases in the corpus
can be done. & 74 & craving \\ \hline
Computer Science is a specialized domain, and so any or-
dinary paraphrases generation cannot be easily used here
unless there is a human effort be involving in marking the
words that can be permuted from the original to form true or
accurate paraphrases & 0.8219 & 0.8014 \\ \hline
\end{tabularx}
\label{tab2.Spec}
\end{table}
\end{document}
答案2
这是一个解决方案,(a)与给出的解决方案非常相似@AboAmmar 的回答,因为它使用tabularx
环境和X
第一列的列类型,并且 (b) 通过省略所有垂直规则并使用更少但间距适当的水平规则,使表格具有更开放的“外观”。
请注意,所有\tabincell
“包装器”指令都可以省略。
\documentclass{article}
\usepackage{tabularx,booktabs}
\usepackage[skip=0.333\baselineskip]{caption} % optional
\begin{document}
\begin{table*}
%\tabcolsep=0.11cm % is this really needed?
\caption{SegNet Performance with Different Optimizers.}
\label{tab2.Spec}
\begin{tabularx}{\textwidth}{@{}Xcc@{}}
\toprule
Text Message & Video Number & State\\
\midrule
Part of the Semantic feature have proved to be a very good feature if the little effort in making paraphrases in the corpus can be done.
& 74 & craving\\
\addlinespace
Computer Science is a specialized domain, and so any ordinary paraphrases generation cannot be easily used here unless there is a human effort be involving in marking the words that can be permuted from the original to form true or accurate paraphrases.
& 0.8219 & 0.8014 \\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}