
As bordas ao redor da tabela a seguir (relativamente simples) estão incompletas/truncadas. O que estou faltando para deixar esta mesa mais 'estanque' e profissional?
\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}
Responder1
Não use regras verticais junto com as macros de desenho de linha do booktabs
pacote. Na verdade, não use regras verticais – acredite, elas não farão falta.
Aqui está um trecho da seção 2 do guia do usuário doguias de livrospacote:
\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}
Responder2
Se você realmente deseja usar regras verticais com booktabs
(o que não está no espírito de booktabs
), você pode {NiceTabular}
usar 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}
Responder3
Obrigado @samcarter-is-at-topanswers-xyz
Você me colocou na direção certa, mas não consegui remover o pacote booktabs sem quebrar 'outras' tabelas em meu documento.
Eu removi o toprule/midrule/bottomrule (parte do pacote booktabs) e os substituí por um hline simples: -
\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}
Responder4
Também defendo a remoção das regras verticais. Simplesmente porque tabelas bem desenhadas podemfalarsozinhos, sem quaisquer acréscimos desnecessários.
No entanto, existe uma maneira demesclarlinhas horizontais e até verticais de espessura diferente se você carregarvariedadepacote. Você apenas altera |
e \hline
para definições personalizadas, sa !{...}
e \noalign{...}
, respectivamente (mais informaçõesaqui.)
O exemplo:
\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}