簡體   English   中英

乳膠小頁表格對齊

[英]Latex minipage table alignment

我試圖將Latex文檔中的兩個表對齊。 盡管這是可行的,但表的位置已關閉。 第一個位於第二個以下: 在此處輸入圖片說明

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

\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}

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

在此處輸入圖片說明

\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 ER字體(在左側表中使用);

  • booktabs提供更好看表。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM