makegapedcells는 rowcolor를 비활성화합니다.

makegapedcells는 rowcolor를 비활성화합니다.

나는 다음과 같은 테이블을 가지고

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\usepackage{graphicx}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{makecell}%To keep spacing of text in tables
\setcellgapes{3pt}%parameter for the spacing

\newcommand{\specialcell}[2][c]{%
    \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

\begin{document}
\begin{table}[h]
    %\makegapedcells
    \centering
    \resizebox{\textwidth}{!}{%resizing the whole table
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
            \hline 
            \multicolumn{9}{|c|}{\Huge Relaisplatine} \\ 
            \hline 
            Relay Nr. & Part & Test-Id & \specialcell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \specialcell[c]{Pin-\\Func.} & R Value & \specialcell[c]{Influenced \\ Signal/Voltage } \\ 
            \hline
            \rowcolor[gray]{0.8} 
            &  &  &  &  & 1 & N.C. & Open & Open \\
            \cline{6-9}
            %\hline 
            0 & WFB & WFB\_VOLT\_SDAR & WFB\_CLOCK\_+1V8 & P2 & 3 & COM &  0 $\Omega$ & SIGN02659 \\
            \cline{6-9}  
            %\hline 
            &  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
            %\cline{6-9}  
            \hline 
            &  &  &  &  & 7 & N.C. &  Open & Open \\ 
            \cline{6-9} 
            1 & WFB & WFB\_CLK & WFB\_CLKDIS153\_MUXOUT  & P2 & 9 & COM &  0 $\Omega$ & P5801 \\ 
            \cline{6-9}
            &  &  &  &  & 11 & N.O. &  0 $\Omega$ & P5802 \\ 
            \hline 
            &  &  &  &  & 13 & N.C. &  Open & Open \\ 
            \cline{6-9} 
            2 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_VCORE & P2 & 15 & COM &  0 $\Omega$ & SIGN02652 \\ 
            \cline{6-9} 
            &  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\ 
            \hline 
            &  &  &  &  &  & N.C. &  Open & Open \\ 
            \cline{6-9} 
            3 & RIO & RIO\_T2\_DATA & RIO\_T2\_DATA & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SDA \\ 
            \cline{6-9} 
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
            \hline 
            &  &  &  &  &  & N.C. &  Open & Open \\ 
            \cline{6-9} 
            4 &  &  &  & P3 &  & COM &  0 $\Omega$ &  \\ 
            \cline{6-9} 
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
            \hline 
            &  &  &  &  & 14 & N.C. &  Open & Open \\ 
            \cline{6-9} 
            5 & RIO & RIO\_T1\_CLK & RIO\_T1\_CLK & P2 & 16 & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SCL1 \\ 
            \cline{6-9} 
            &  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\ 
            \hline 
            &  &  &  &  & 8 & N.C. &  Open & Open \\ 
            \cline{6-9} 
            6 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_MGTVCCAUX & P2 & 10 & COM &  0 $\Omega$ & SIGN02672 \\ 
            \cline{6-9} 
            &  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\ 
            \hline 
            &  &  &  &  & 2 & N.C. &  Open & Open \\ 
            \cline{6-9} 
            7 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_AVTT & P2 & 4 & COM &  0 $\Omega$ & SIGN02661 \\ 
            \cline{6-9} 
            &  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\ 
            \hline 
        \end{tabular}
    }
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
\end{table}
\end{document}

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

보시다시피 Relaisplatine이라는 테이블 제목이 테이블 테두리에 닿아 있습니다. 이 문제를 해결하기 위해 을 사용했지만 \makegapedcells이를 사용하면 행 색상이 비활성화됩니다.

제목이 경계선에 닿지 않고 색상 행이 표시되도록 하려면 어떻게 해야 합니까?

답변1

\makegapedcells패키지의 매크로는 makecell테이블 색상 지정과 호환되지 않습니다. 비슷한 경우에는 셀에 수직 공백을 추가하려는 경우 열 유형에 대한 패키지 cellspace및 확장을 사용할 수 있습니다 .S

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\usepackage[table]{xcolor}
\usepackage{cellspace, makecell, multirow}% for tables
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

%-------------------------------------- only for show page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{table}%[ht]
    \tiny
    \setlength\tabcolsep{3pt}
    \centering
        \begin{tabular}{|c|c|c|c|c|c|Sc|c|c|}
            \hline
            \multicolumn{9}{|>{\normalsize}Sc|}{Relaisplatine} \\
            \hline
\makecell{Relay\\ Nr.} & Part & Test-Id & \makecell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \makecell[c]{Pin-\\Func.} & R  & \makecell[c]{Influenced \\ Signal/Voltage } \\
            \hline
            \rowcolor[gray]{0.8}
            &  &  &  &  & 1 & N.C. & Open & Open \\
            \cline{6-9}
            %\hline
            0 & WFB & WFB\_VOLT\_SDAR & WFB\_CLOCK\_+1V8 & P2 & 3 & COM &  0 $\Omega$ & SIGN02659 \\
            \cline{6-9}
            %\hline
            &  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
            %\cline{6-9}
            \hline
            &  &  &  &  & 7 & N.C. &  Open & Open \\
            \cline{6-9}
            1 & WFB & WFB\_CLK & WFB\_CLKDIS153\_MUXOUT  & P2 & 9 & COM &  0 $\Omega$ & P5801 \\
            \cline{6-9}
            &  &  &  &  & 11 & N.O. &  0 $\Omega$ & P5802 \\
            \hline
            &  &  &  &  & 13 & N.C. &  Open & Open \\
            \cline{6-9}
            2 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_VCORE & P2 & 15 & COM &  0 $\Omega$ & SIGN02652 \\
            \cline{6-9}
            &  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  &  & N.C. &  Open & Open \\
            \cline{6-9}
            3 & RIO & RIO\_T2\_DATA & RIO\_T2\_DATA & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SDA \\
            \cline{6-9}
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  &  & N.C. &  Open & Open \\
            \cline{6-9}
            4 &  &  &  & P3 &  & COM &  0 $\Omega$ &  \\
            \cline{6-9}
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  & 14 & N.C. &  Open & Open \\
            \cline{6-9}
            5 & RIO & RIO\_T1\_CLK & RIO\_T1\_CLK & P2 & 16 & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SCL1 \\
            \cline{6-9}
            &  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\
            \hline
            &  &  &  &  & 8 & N.C. &  Open & Open \\
            \cline{6-9}
            6 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_MGTVCCAUX & P2 & 10 & COM &  0 $\Omega$ & SIGN02672 \\
            \cline{6-9}
            &  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\
            \hline
            &  &  &  &  & 2 & N.C. &  Open & Open \\
            \cline{6-9}
            7 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_AVTT & P2 & 4 & COM &  0 $\Omega$ & SIGN02661 \\
            \cline{6-9}
            &  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\
            \hline
        \end{tabular}
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
\end{table}
\end{document}

대신 specialcell(MWE에 정의되지 않음) \makecell{...}`makecell} 패키지의 표준을 사용합니다.

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

위의 MWE에서는 \resizebox{\textwidth}{!}{%resizing the whole table ...}글꼴 크기를 \tiny. 이는 일반 읽기에 비해 텍스트가 너무 작기 때문에 독자에게는 심각한 문제가 될 수 있습니다(위의 내 의견 참조).

부록: 테이블 회전을 고려하려는 경우 다음 sMWE가 도움이 될 수 있는지 확인하세요. 글꼴 크기를 로 줄인 경우에도 \small테이블 너비가 텍스트 높이보다 큽니다.

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\usepackage{rotating}
\usepackage[table]{xcolor}
\usepackage{cellspace, makecell, multirow}% for tables
\setlength\cellspacetoplimit{3pt}       % additional top vertical spaces in cells
\setlength\cellspacebottomlimit{3pt}    % additional bottom vertical spaces in cells

%-------------------------------------- only for show page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{sidewaystable}
    \centering
    \small
\begin{tabular}{|c|c|c|c|c|c|Sc|c|c|}% added S foractivate additional vertical spaces in cels
    \hline
\multicolumn{9}{|Sc|}{Relaisplatine} \\
    \hline
\makecell{Relay\\ Nr.} & Part & Test-Id & \makecell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \makecell[c]{Pin-\\Func.} & R  & \makecell[c]{Influenced \\ Signal/Voltage }        \\
    \hline
\rowcolor[gray]{0.8}
&  &  &  &  & 1 & N.C. & Open & Open \\
    \cline{6-9}
0 & WFB & WFB\_VOLT\_SDAR & WFB\_CLOCK\_+1V8 & P2 & 3 & COM &  0 $\Omega$ & SIGN02659 \\
    \cline{6-9}
&  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
    \hline
&  &  &  &  & 7 & N.C. &  Open & Open \\
    \cline{6-9}
1 & WFB & WFB\_CLK & WFB\_CLKDIS153\_MUXOUT  & P2 & 9 & COM &  0 $\Omega$ & P5801 \\
    \cline{6-9}
&  &  &  &  & 11 & N.O. &  0 $\Omega$ & P5802 \\
    \hline
&  &  &  &  & 13 & N.C. &  Open & Open \\
    \cline{6-9}
2 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_VCORE & P2 & 15 & COM &  0 $\Omega$ & SIGN02652 \\
    \cline{6-9}
&  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\
    \hline
&  &  &  &  &  & N.C. &  Open & Open \\
    \cline{6-9}
3 & RIO & RIO\_T2\_DATA & RIO\_T2\_DATA & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SDA \\
    \cline{6-9}
&  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
    \hline
&  &  &  &  &  & N.C. &  Open & Open \\
    \cline{6-9}
4 &  &  &  & P3 &  & COM &  0 $\Omega$ &  \\
    \cline{6-9}
&  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
    \hline
&  &  &  &  & 14 & N.C. &  Open & Open \\
    \cline{6-9}
5 & RIO & RIO\_T1\_CLK & RIO\_T1\_CLK & P2 & 16 & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SCL1 \\
    \cline{6-9}
&  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\
    \hline
&  &  &  &  & 8 & N.C. &  Open & Open \\
    \cline{6-9}
6 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_MGTVCCAUX & P2 & 10 & COM &  0 $\Omega$ & SIGN02672 \\
    \cline{6-9}
&  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\
    \hline
&  &  &  &  & 2 & N.C. &  Open & Open \\
    \cline{6-9}
7 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_AVTT & P2 & 4 & COM &  0 $\Omega$ & SIGN02661 \\
    \cline{6-9}
&  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\
    \hline
\end{tabular}
\caption{Verkabelung der ersten Relaisplatine an X400/PortA}
    \end{sidewaystable}
\end{document}

답변2

{NiceTabular}와 호환되는 nicematrix키가 있습니다 .cell-space-limits\rowcolor

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\usepackage{xcolor}
\usepackage{nicematrix}

\begin{document}
\begin{table}%[ht]
    \tiny
    \setlength\tabcolsep{3pt}
    \centering
        \begin{NiceTabular}{|c|c|c|c|c|c|c|c|c|}[colortbl-like,cell-space-limits=4pt]
            \hline
            \Block{1-9}{\normalsize Relaisplatine} \\
            \hline
\Block{}{Relay\\ Nr.} & Part & Test-Id & \Block{}{Signal-Name \\for Testcases} & Conn. & Pin & \Block{}{Pin-\\Func.} & R  & \Block{}{Influenced \\ Signal/Voltage } \\
            \hline
            \rowcolor[gray]{0.8}
            &  &  &  &  & 1 & N.C. & Open & Open \\
            \cline{6-9}
            0 & WFB & WFB\_VOLT\_SDAR & WFB\_CLOCK\_+1V8 & P2 & 3 & COM &  0 $\Omega$ & SIGN02659 \\
            \cline{6-9}
            &  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  & 7 & N.C. &  Open & Open \\
            \cline{6-9}
            1 & WFB & WFB\_CLK & WFB\_CLKDIS153\_MUXOUT  & P2 & 9 & COM &  0 $\Omega$ & P5801 \\
            \cline{6-9}
            &  &  &  &  & 11 & N.O. &  0 $\Omega$ & P5802 \\
            \hline
            &  &  &  &  & 13 & N.C. &  Open & Open \\
            \cline{6-9}
            2 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_VCORE & P2 & 15 & COM &  0 $\Omega$ & SIGN02652 \\
            \cline{6-9}
            &  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  &  & N.C. &  Open & Open \\
            \cline{6-9}
            3 & RIO & RIO\_T2\_DATA & RIO\_T2\_DATA & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SDA \\
            \cline{6-9}
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  &  & N.C. &  Open & Open \\
            \cline{6-9}
            4 &  &  &  & P3 &  & COM &  0 $\Omega$ &  \\
            \cline{6-9}
            &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\
            \hline
            &  &  &  &  & 14 & N.C. &  Open & Open \\
            \cline{6-9}
            5 & RIO & RIO\_T1\_CLK & RIO\_T1\_CLK & P2 & 16 & COM &  0 $\Omega$ & RIO\_GPP\_I2C\_SCL1 \\
            \cline{6-9}
            &  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\
            \hline
            &  &  &  &  & 8 & N.C. &  Open & Open \\
            \cline{6-9}
            6 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_MGTVCCAUX & P2 & 10 & COM &  0 $\Omega$ & SIGN02672 \\
            \cline{6-9}
            &  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\
            \hline
            &  &  &  &  & 2 & N.C. &  Open & Open \\
            \cline{6-9}
            7 & WFB & WFB\_VOLT\_SDAR & WFB\_WF\_FPGA\_AVTT & P2 & 4 & COM &  0 $\Omega$ & SIGN02661 \\
            \cline{6-9}
            &  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\
            \hline
        \end{NiceTabular}
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
\end{table}
\end{document}

여러 컴파일이 필요합니다( nicematrix내부적으로 PGF/Tikz를 사용하기 때문에).

위 코드의 출력

관련 정보