NiceTabular(NiceMatrix) 수직선이 없는 빈 줄

NiceTabular(NiceMatrix) 수직선이 없는 빈 줄

환경에 작고 빈 줄을 추가하려고 합니다 NiceTabular. 그만큼NiceMatrix 수동상태(섹션 5.1.1 수직 규칙):

nicematrix 환경에서는 | 환경의 서문에서는 불완전한 행이나 \hline\hline으로 지정된 이중 수평 규칙에 의해서도 절대 깨지지 않습니다.

즉, 여기의 빈 줄은 수직 규칙을 나타냅니다.

\begin{table}[h]
    \small
    \centering
    \begin{NiceTabularX}{\textwidth}{ll}[hvlines]
        \textit{Year}
        &
        \textit{Fruit}
    \\ \hline \hline
        2022
        &
        Apple
    \\
    \end{NiceTabularX}
\end{table}

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

블록에 대한 빠른 시도는 여전히 가장 바깥쪽(=경계) 수직 규칙을 포함하는 전체 높이 선을 제공했습니다.

\begin{table}[h]
    \small
    \centering
    \begin{NiceTabularX}{\textwidth}{ll}[hvlines]
        \textit{Year}
        &
        \textit{Fruit}
    \\ \Block{1-2}{\hline \hline} \\
        2022
        &
        Apple
    \\
    \end{NiceTabularX}
\end{table}

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

수직선 없이 행 사이에 작은 빈 줄을 만들려면 어떻게 해야 합니까?

답변1

( 에 의해 로드되는 {tabular}패키지의 ) 클래식 규칙을 사용할 수 있습니다 .arraynicematrix

이는 다음을 의미합니다.

  • 당신은 고전적인 명령을 사용합니다 \hline(그리고 \hline\hline이중 규칙의 경우).
  • |당신은 고전 적인 행동으로 열 유형을 정의해야합니다 array(고전적인 |of는 array에 의해 덮어 쓰여졌습니다 nicematrix): \newcolumntype{I}{!{\vrule}}작업을 수행합니다.
\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\newcolumntype{I}{!{\vrule}}

\begin{table}[h]
\small
\centering
\begin{NiceTabular}{IlIlI}
    \hline
    \textit{Year}
    &
    \textit{Fruit} \\
    \hline\hline
    2022
    &
    Apple \\
    \hline
\end{NiceTabular}
\end{table}

\end{document}

물론, 이 예에서는 {NiceTabular}(저는 사용하겠지만 {tabular}) 실제 테이블 형식에서 제공되는 다른 기능을 사용하고 싶을 수도 있습니다 nicematrix.

위 코드의 출력


반면에 의 주요 기능은 nicematrix클래식 의 셀, 열 및 행 아래에 PGF/Tikz 노드를 삽입하는 것입니다 {tabular}. 이는 해당 노드를 사용하여 Tikz로 원하는 규칙을 그리는 것이 항상 가능하다는 것을 의미합니다.


\begin{table}[h]
\small
\centering
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}{ll}[hvlines]
    \textit{Year}
    &
    \textit{Fruit} \\
    2022
    &
    Apple \\
\CodeAfter
    \tikz \draw [line width = 2 \pgflinewidth] (2-|1) -- (2-|last) ; 
    \tikz \draw [white, shorten > = -1 pt, shorten <= -1 pt] (2-|1) -- (2-|last) ; 
\end{NiceTabular}
\end{table}

\end{document}

두 번째 코드의 출력

관련 정보