2015-10-13 96 views
1
\begin{center} 
\begin{table}[h!] 
\centering 
\begin{tabular}{|l|l|l|l|} 

    \hline 
Name of the Dataset File & Number of Cases & Number of Records & Primary Key \\ 
\hline 
Detail Interaction & 147,004 & 2400 & Interaction ID \\ 
\hline 
Detail Incident & \\ 
\hline 
Detail Change & \\ 
\hline 
Detail Activity & \\ 
\hline 
\end{tabular} 
\caption{Dataset description of the four datasets provided by Rabobank Group ICT.} 
\end{table} 
\end{center} 

表格不適合頁面。有人可以幫助我在一個頁面中製作它。該表有4列和5行。乳膠表格語法

+0

嗨!請告訴我們,如果這個問題解決了,或者下面的答案有幫助的話。 – MattAllegro

回答

0

首先,你的代碼是缺少一些&秒,在線路11,13和15:儘量

\begin{table}[h!] 
     \centering 
     \begin{tabular}{|l|l|l|l|} 
      \hline 
      Name of the Dataset File & Number of Cases & Number of Records & Primary Key \\ 
      \hline 
      Detail Interaction & 147,004 & 2400 & Interaction ID \\ 
      \hline 
      Detail Incident & & & \\% 2 occurrences of & added here 
      \hline 
      Detail Change & & & \\% 2 occurrences of & added here 
      \hline 
      Detail Activity & & & \\% 2 occurrences of & added here 
      \hline 
     \end{tabular} 
     \caption{Dataset description of the four datasets provided by Rabobank Group ICT.} 
    \end{table} 

在第二種情況下,我建議你看,如果你喜歡像

\begin{tabular}{|p{.3\textwidth}|p{.2\textwidth}|p{.2\textwidth}|p{.2\textwidth}|} 

,而不是僅僅

\begin{tabular}{|l|l|l|l|} 

在這種情況下,你可以使用\par在單元格內獲得換行符(例如:Name of the\par Dataset File)。

1

我建議使用booktabs寫表中一個更優雅的方式,因爲似乎有些多餘信息標題:

enter image description here

\documentclass{article} 

\usepackage{booktabs,siunitx} 

\begin{document} 

\noindent 
\begin{tabular}{ l r r l } 
    \toprule 
    Dataset Filename & \multicolumn{1}{c}{Cases} & \multicolumn{1}{c}{Records} & Primary Key \\ 
    \midrule 
    Detail Interaction & \num{147004} & \num{2400} & InteractionID \\ 
    Detail Incident & \num{12345} & \num{20000} & IncidentID \\ 
    Detail Change & \num{12} & \num{412} & ChangeID \\ 
    Detail Activity & \num{7890} & \num{1234567} & ActivityID \\ 
    \bottomrule 
\end{tabular} 

\end{document}