
Los bordes alrededor de la siguiente tabla (relativamente simple) están incompletos/truncados. ¿Qué me falta para que esta mesa luzca más 'estanca' y profesional?
\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}
Respuesta1
No utilice reglas verticales junto con las macros de dibujo lineal del booktabs
paquete. En realidad, no utilices reglas verticales en absoluto; créeme, no las pasarás por alto.
Aquí hay un extracto de la sección 2 de la guía del usuario depestañaspaquete:
\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}
Respuesta2
Si realmente desea utilizar reglas verticales con booktabs
(lo cual no está en absoluto en el espíritu de booktabs
), puede utilizar {NiceTabular}
de 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}
Respuesta3
Gracias @samcarter-is-at-topanswers-xyz
Me pusiste en la dirección correcta, pero no pude eliminar el paquete booktabs sin romper "otras" tablas en mi documento.
Eliminé toprule/midrule/bottomrule (parte del paquete booktabs) y los reemplacé con una simple 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}
Respuesta4
También abogo por eliminar las reglas verticales. Simplemente porque las mesas bien diseñadas puedenhablarpor sí mismos sin adiciones innecesarias.
Sin embargo, hay una manera deunirLíneas horizontales e incluso verticales de diferente grosor si cargasformaciónpaquete. Simplemente cambia |
y \hline
a definiciones personalizadas, sa !{...}
y \noalign{...}
, respectivamente (más informaciónaquí.)
El ejemplo:
\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}