自動調整表格中儲存格的大小?

自動調整表格中儲存格的大小?

我本質上希望我的文字換行在表格的第三列中。就我現在所擁有的而言,文字繼續通過我的表格並離開文件的右側。這是我的程式碼。

\begin{table}[h]
\centering
\begin{tabularx}{\linewidth}{|l|l|X|}
\hline
\textbf{Item} & \textbf{Due} & \textbf{Specifics and Owner}                                                                                                                                                                                                                         
\\ \hline
Progress Report 1 & 2/15 & \begin{tabular}[c]{@{}l@{}}Preprocess data. Create simple neural network as proof of concept.\\ Owners: Group Effort\end{tabular}                                                                                                                   \\ \hline
Progress Report 2 & 3/15 & \begin{tabular}[c]{@{}l@{}}First implementation of working neural network x-ray classifier. Includes any improvement over randomly classifying data.\\ Owners: Group Effort\end{tabular}                                                            \\ \hline
Preliminary Writeup & 4/12 & \begin{tabular}[c]{@{}l@{}}Strong improvement in classification by supervising neural network weight selection. \\ Owners: Group Effort\end{tabular}                                                                                                \\ \hline
Final Oral Presentation \& Report & 4/24 - 4/26  & \begin{tabular}[c]{@{}l@{}}Finished product that is demonstrable. Possibly a final push to see improvements over Preliminary Writeup results. Make sure there is a group understanding of all applied concepts.\\ Owners: Group Effort\end{tabular} \\ \hline
\end{tabularx}
\end{table}

當前發生的情況的圖像:https://i.stack.imgur.com/oPwzO.jpg

答案1

請始終提供可編譯的最小工作範例!

您不需要巢狀表。X的列已經tabularx換行文字。為了在列的儲存格內放置換行符X,請放置\newline取代\\(這將啟動一個新的表格行)。

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{table}[h]
%\centering   % see Mico's comment
\begin{tabularx}{\linewidth}{|l|l|X|}
\hline
\textbf{Item} & \textbf{Due} & \textbf{Specifics and Owner} \\ \hline
Progress Report 1 & 2/15 & Preprocess data. Create simple neural network as proof of concept.\newline Owners: Group Effort \\ \hline
Progress Report 2 & 3/15 & First implementation of working neural network x-ray classifier. Includes any improvement over randomly classifying data.\newline Owners: Group Effort \\ \hline
Preliminary Writeup & 4/12 & Strong improvement in classification by supervising neural network weight selection. \newline Owners: Group Effort \\ \hline
Final Oral Presentation \& Report & 4/24--4/26 & Finished product that is demonstrable. Possibly a final push to see improvements over Preliminary Writeup results. Make sure there is a group understanding of all applied concepts.\newline Owners: Group Effort \\ \hline
\end{tabularx}
\end{table}

\end{document}

生產:

在此輸入影像描述


編輯:

另一個版本使用booktabs並由\RaggedRight幾條評論提出:

\documentclass{article}
\usepackage{tabularx,booktabs,ragged2e}

\begin{document}

\begin{table}[h]
%\centering   % see Mico's comment
\begin{tabularx}{\linewidth}{l l >{\RaggedRight}X}
\toprule
\textbf{Item} & \textbf{Due} & \textbf{Specifics and Owner} \\ \midrule
Progress Report 1 & 2/15 & Preprocess data. Create simple neural network as proof of concept.\newline Owners: Group Effort \\ \midrule
Progress Report 2 & 3/15 & First implementation of working neural network x-ray classifier. Includes any improvement over randomly classifying data.\newline Owners: Group Effort \\ \midrule
Preliminary Writeup & 4/12 & Strong improvement in classification by supervising neural network weight selection. \newline Owners: Group Effort \\ \midrule
Final Oral Presentation \& Report & 4/24--4/26 & Finished product that is demonstrable. Possibly a final push to see improvements over Preliminary Writeup results. Make sure there is a group understanding of all applied concepts.\newline Owners: Group Effort \\ \bottomrule
\end{tabularx}
\end{table}

\end{document}

在此輸入影像描述

相關內容