行高不一樣

行高不一樣

在此輸入影像描述

我創建了一個如下圖所示的表格,但我不確定它是否可以。我的意思是,為什麼在兩行的第一行之後顯示行間隙。我用紅色標記了它。還是這是正確的行為?誰能告訴我嗎?我在這裡添加了我的程式碼。

\begin{table}[htbp]
    \centering
    \caption{Summary of the comparison with existing approaches}
    \label{tab:Testing Results} 
    \begin{tabular}{|p{.30 cm}|p{2.2cm}|l|l|l|}
        \hline
         \multicolumn{2}{|p{2.5cm}|} {\diagbox { }{Approach}}&Lizhi [4]&Yuan [9]&Our Approach\\\hline
                      CS1 & Total Paths &6 &10 &3\\  \cline{2-5}
                     & Feasible Paths &6 &3 &3\\  \cline{2-5}
                     & Infeasible Paths &0 &7 &0 \\\hline 
                     CS2 & Total Paths &35 &6 &1\\ \cline{2-5}
                     & Feasible Paths &35 &4 &1\\ \cline{2-5}
                     & Infeasible Paths &0 &2 &0 \\\hline
    \end{tabular}
\end{table}

答案1

表格的簡化版本,行數較少且數字對齊:

\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{diagbox}
\usepackage{siunitx}
\begin{document}
\begin{table}[htbp]
  \centering
  \caption{Summary of the comparison with existing approaches}
  \label{tab:Testing Results}
  \begin{tabular}{
    l
    l
    S[table-format=2]
    S[table-format=2]
    S[table-format=1]
  }
    \toprule
    & & \multicolumn{3}{c}{Approach}\\
    \cmidrule{3-5}
    & & {Lizhi [4]}&{Yuan [9]}&{Our approach}\\
    \midrule
    CS1 & Total paths &6 &10 &3\\
        & Feasible paths &6 &3 &3\\
        & Infeasible paths &0 &7 &0 \\
    \addlinespace
    CS2 & Total paths &35 &6 &1\\
        & Feasible paths &35 &4 &1\\
        & Infeasible paths &0 &2 &0 \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

結果

進一步說明:

  • 參考書目也可以透過 LaTeX 完成,[4]並且[9]可以透過呼叫巨集來替換\cite

  • 我沒有看到使用標題大小寫的理由。因此,此範例對錶中的條目使用簡單句大小寫。

  • Our approach可能會被截斷為Our.

相關內容