複数列の垂直指定子

複数列の垂直指定子

次の行のように、複数列に白い垂直指定子を追加するにはどうすればよいですか? より広い垂直指定子を使用することもできますか?

\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}

ここに画像の説明を入力してください

関連情報