다음 행과 같이 여러 열에 흰색 세로 지정자를 어떻게 추가합니까? 더 넓은 수직 지정자를 갖는 것도 가능합니까?
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}[h!]
\centering
\caption{Caption}
%\label{table:Label}
\renewcommand{\arraystretch}{1.2}% for the vertical padding
%\begin{tabular}{ c| c }
\begin{tabular}{c!{\color{white}\vrule}c}
%\rowcolor{cyan!30}
%\multicolumn{1}{c}{Σχέση} & \multicolumn{1}{c}{Τύπος} \\
%\multicolumn{1}{l!{\color{white}\vrule}l}{Σχέση} & \multicolumn{1}{c}{Τύπος} \\
& \\[-1.3em]
\multicolumn{1}{c}{{\cellcolor{cyan!30}}Title 1} & \multicolumn{1}{c}{{\cellcolor{cyan!30}}Title 2} \\
& \\[-1.3em]
\rule{0pt}{1.5em}\cellcolor{black!10} A & \cellcolor{red!10} B \\[.5em]
& \\[-1.3em]
\rule{0pt}{1.5em}\cellcolor{black!10} B & \cellcolor{red!10} D \\[.5em]
\end{tabular}
\end{table}
\end{document}
답변1
귀하의 요구 사항을 이해했는지 잘 모르겠지만 다음을 사용할 수 있다고 생각합니다 tabularray
.
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
\begin{table}[h!]
\centering
\caption{Caption}\label{table:Label}
\begin{tblr}{
cells={c,m},stretch=0,
vlines={white}, hlines={white},
column{1}={black!10},
column{2}={red!10},
row{1}={cyan!30},
rows={ht=.8cm},
}
Title 1 & Title 2 \\
A & B \\
B & D \\
\end{tblr}
\end{table}
\end{document}
답변2
흰색 규칙을 원하면 LaTeX에 지시하십시오.
를 사용하면 \mystrut
셀의 수직 확장 정도를 선택할 수 있습니다. 여기서는 무엇이든 \mystrut
실험할 수 있습니다 .\mystrut[1.2]
\documentclass{article}
\usepackage{fontspec}
\usepackage[table]{xcolor}
\setmainfont{Old Standard} % supports Greek
\newcommand{\mystrut}[1][1.5]{%
\vrule width 0pt height 1.5\ht\strutbox depth 1.5\dp\strutbox\relax
}
\begin{document}
\begin{table}[htp!]
\centering
\arrayrulecolor{white}
\setlength{\arrayrulewidth}{1pt}
\begin{tabular}{>{\mystrut}c|c}
\rowcolor{cyan!30}
Σχέση & Τύπος \\
\cellcolor{cyan!30}Title 1 & \cellcolor{cyan!30}Title 2 \\
\hline
\cellcolor{black!10} A & \cellcolor{red!10} B \\
\cellcolor{black!10} B & \cellcolor{red!10} D \\
\end{tabular}
\caption{Caption}\label{table:Label}
\end{table}
\end{document}