불완전한 테이블 테두리, 잘림, 방수

불완전한 테이블 테두리, 잘림, 방수

다음 (비교적 간단한) 테이블 주위의 테두리는 불완전하거나 잘립니다. 이 테이블을 더욱 '완벽'하고 전문적으로 보이도록 하기 위해 내가 놓치고 있는 것은 무엇입니까?

\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( 전혀 의 정신이 아님 ) of 를 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

나는 또한 수직적 규칙을 없애는 것을 옹호합니다. 단순히 잘 디자인된 테이블이말하다불필요한 추가 없이 자체적으로.

그러나 방법이 있습니다병합로드하는 경우 두께가 다른 가로선 및 세로선까지정렬패키지. |와 를 각각 사용자 \hline정의 정의 sa !{...}와 으로 변경하면 됩니다 \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}

여기에 이미지 설명을 입력하세요

관련 정보