2017-10-18 110 views
0

我試圖將Latex文檔中的兩個表對齊。雖然這是行得通的,但表格的位置已關閉。第一個位於低於第二個: enter image description here乳膠小型表對齊

有誰知道如何解決這個問題?下面是我的代碼:

\begin{table}[t] 
\begin{minipage}{.55\linewidth} 
    \begin{tabular}{l|l} 
     \multicolumn{1}{c|}{\textbf{WordNet}} & \textbf{FreeBase} \\ \hline 
     domain\_region          & cause\_of\_death    \\ 
     domain\_topic          & ethnicity      \\ 
     has\_instance          & gender       \\ 
     has\_part           & institution      \\ 
     member\_holonym          & nationality      \\ 
     member\_meronym          & profession      \\ 
     part\_of           & religion      \\ 
     similar\_to           &         \\ 
     subordinate\_instance\_of       &         \\ 
     synset\_domain\_topic        &         \\ 
     type\_of           &         
    \end{tabular} 
    \label{table1} 
    \caption{Relationships in WordNet \& FreeBase KBs} 
\end{minipage}% 
\begin{minipage}{.5\linewidth} 
    \centering 
    \begin{tabular}{cccc} 
     \multicolumn{4}{c}{\textbf{Holdout Set Construction}}         \\ 
     \multicolumn{2}{c}{\textbf{WordNet}}   & \multicolumn{2}{c}{\textbf{FreeBase}} \\ \hline 
     Word Removed & \multicolumn{1}{c|}{\# Triples} & Name Removed  & \# Triples  \\ 
     adult  & \multicolumn{1}{c|}{166}  & Alan Turing   & 15    \\ 
     botany  & \multicolumn{1}{c|}{166}  & Carl Sagan   & 18    \\ 
     building  & \multicolumn{1}{c|}{185}  & Frank Zappa   & 16    \\ 
     center  & \multicolumn{1}{c|}{180}  & Isaac Asimov  & 20    \\ 
     form   & \multicolumn{1}{c|}{172}  & John Denver   & 16    \\ 
     game   & \multicolumn{1}{c|}{267}  & Karl Marx   & 13    \\ 
     lake   & \multicolumn{1}{c|}{227}  & Mary Astor   & 14    \\ 
     land   & \multicolumn{1}{c|}{153}  & Su Song    & 13    \\ 
     mythology & \multicolumn{1}{c|}{178}  & Tupac Shakur  & 14    \\ 
     room   & \multicolumn{1}{c|}{189}  & ...     & ...    
    \end{tabular} 
    \caption{Ten words and a sample of 60 names used for constructing Holdout sets for WordNet and FreeBase, respectively. The numbers of triples that each    entity occurs in are listed to the right. These triples comprise the Holdout sets} 
    \label{table2} 
\end{minipage} 
\end{table} 
+0

在[TeX SE](https://tex.stackexchange.com)或許更好地問一下,但你也應該指定你想要的對齊方式:如果你對齊頂端,那麼分隔線不會對齊,反之亦然。 – Nick

回答

0

你可以嘗試用相同的內容設置tabular S,即使有些行可能是空的。這將確保它們具有相同的高度:

enter image description here

\documentclass{article} 

\usepackage[T1]{fontenc} 
\usepackage[landscape]{geometry}% Just for this example 

\usepackage{booktabs} 

\begin{document} 

\begin{table} 
    \mbox{}\hfill 
    \begin{minipage}[t]{.48\linewidth} 
    \centering{\ttfamily 
    \begin{tabular}{ l l } 
     \toprule 
     \\ 
     \multicolumn{1}{ c }{\normalfont\bfseries WordNet} & \multicolumn{1}{ c }{\normalfont\bfseries FreeBase} \\ 
     \midrule 
     domain\_region          & cause\_of\_death    \\ 
     domain\_topic          & ethnicity      \\ 
     has\_instance          & gender      \\ 
     has\_part           & institution     \\ 
     member\_holonym          & nationality     \\ 
     member\_meronym          & profession     \\ 
     part\_of           & religion      \\ 
     similar\_to           &        \\ 
     subordinate\_instance\_of       &        \\ 
     synset\_domain\_topic        &        \\ 
     type\_of           &        \\ 
     \bottomrule 
    \end{tabular}} 

    \caption{Relationships in WordNet \& FreeBase KBs.} 
    \end{minipage}\hfill 
    \begin{minipage}[t]{.48\linewidth} 
    \centering 
    \begin{tabular}{ c c c c } 
     \toprule 
     \multicolumn{4}{c}{\bfseries Holdout Set Construction}         \\ 
     \multicolumn{2}{c}{\bfseries WordNet}   & \multicolumn{2}{c}{\bfseries FreeBase} \\ 
     \midrule 
     \itshape Word Removed & \itshape\# Triples & \itshape Name Removed & \itshape \# Triples  \\ 
     adult  & 166  & Alan Turing   & 15    \\ 
     botany  & 166  & Carl Sagan   & 18    \\ 
     building  & 185  & Frank Zappa   & 16    \\ 
     center  & 180  & Isaac Asimov  & 20    \\ 
     form   & 172  & John Denver   & 16    \\ 
     game   & 267  & Karl Marx   & 13    \\ 
     lake   & 227  & Mary Astor   & 14    \\ 
     land   & 153  & Su Song    & 13    \\ 
     mythology & 178  & Tupac Shakur  & 14    \\ 
     room   & 189  & \ldots    & \ldots   \\ 
     \bottomrule 
    \end{tabular} 

    \caption{Ten words and a sample of 60 names used for constructing Holdout sets for WordNet and FreeBase, 
     respectively. The numbers of triples that each entity occurs in are listed to the right. 
     These triples comprise the Holdout sets.} 
    \end{minipage}\hfill 
    \mbox{} 
\end{table} 

\end{document} 

我用

  • fontenc產生t ypewri t呃字體內更好\_(左使用手錶);

  • booktabs提供更好看的表格。

  • \itshape將右表內的子標題與同一表內的其他內容區分開來。