不完全な表の境界、切り捨てられた、防水

不完全な表の境界、切り捨てられた、防水

次の (比較的単純な) 表の周囲の境界線が不完全/切り捨てられています。この表をより「漏れのない」プロフェッショナルな外観にするには、何が足りないのでしょうか。

\begin{tabular} {|p{3cm}|p{1.5cm}|} 
\toprule
\centering\textbf{Feature} & \centering\textbf{MRR}  \tabularnewline
\midrule
Heuristic only & 0.59    \tabularnewline\hline
Heuristic with QACES & 0.63   \tabularnewline\hline
Percentage change & +6.8\% \tabularnewline

\bottomrule
\end{tabular}

切り捨てられた境界線:

答え1

パッケージの線描画マクロと一緒に垂直罫線を使用しないでくださいbooktabs。実際、垂直罫線はまったく使用しないでください。信じてください、垂直罫線がなくても問題ありません。

以下は、ユーザーガイドのセクション2からの抜粋です。ブックタブパッケージ:

ここに画像の説明を入力してください


ここに画像の説明を入力してください

\documentclass{article}
\usepackage{booktabs,array,ragged2e}
\begin{document}

\begin{tabular} {@{} 
          >{\RaggedRight\hangafter1\hangindent1em}p{3cm} % automatic hanging indentation
          c 
          @{}} 
  \toprule
  \textbf{Feature}     & \textbf{MRR} \\
  \midrule
  Heuristic only       & 0.59    \\
  Heuristic with QACES & 0.63    \\
  Percentage change    & +6.8\%  \\
  \bottomrule
\end{tabular}

\end{document}

答え2

実際に で垂直線を使用したい場合はbooktabs( の精神にはまったく反しますが)、の をbooktabs使用できます。{NiceTabular}nicematrix

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}

\begin{document}

\begin{NiceTabular} {|p{3cm}|p{1.5cm}|} 
\toprule
\centering\textbf{Feature} & \centering \textbf{MRR} \tabularnewline
\midrule
Heuristic only & 0.59   \\
Heuristic with QACES & 0.63  \\
Percentage change & +6.8\% \\
\bottomrule
\end{NiceTabular}

\end{document}

上記コードの出力

答え3

ありがとう@samcarter-is-at-topanswers-xyz

正しい方向に導いてくれましたが、ドキュメント内の「他の」テーブルを壊さずに booktabs パッケージを削除することはできませんでした。

私は toprule/midrule/bottomrule (booktabs パッケージの一部) を削除し、単純な hline に置き換えました: -

\begin{tabular}{|c|c|}
\hline
\centering\textbf{Feature} & \centering\textbf{MRR}  \tabularnewline
\hline
Heuristic only & 0.57 $\pm$ 0.12    \\
Heuristic with QACES & 0.60 $\pm$ 0.12  \\
Percentage change & +5.3\% \\
\hline
\end{tabular}

これにより、次のものが生成されます。 ブックタブなしの防水テーブル

答え4

私は縦罫線をなくすことも提唱しています。単に、よくデザインされた表は話す余分な添加物なしで、そのまま使用できます。

しかし、マージ異なる太さの水平線や垂直線をロードすると配列パッケージ。 と をそれぞれ sa と というカスタム定義に変更するだけ|です(\hline詳細情報!{...}\noalign{...}ここ

例:

\documentclass{article}
\usepackage{array}

\begin{document}
\begin{table}[tbh]
    \setlength\arrayrulewidth{0.2pt}
    \renewcommand*\arraystretch{1.35}
    \begin{tabular}{|
            >{\raggedright}p{3cm} !{\vrule width 0.8pt}
            >{\centering\arraybackslash}p{1.5cm} |
        } 
        \noalign{\hrule height 0.8pt}
        \centering\textbf{Feature} & \textbf{MRR} \\\noalign{\hrule height 0.5pt}
        Heuristic only             & 0.59         \\\hline
        Heuristic with QACES       & 0.63         \\\hline
        Percentage change          & +6.8\%       \\\noalign{\hrule height 0.8pt}
    \end{tabular}
    \end{table}
\end{document}

ここに画像の説明を入力してください

関連情報