Closed Aljumaily closed 10 months ago
After configuring the crossing or trimming positions for both hlines and vlines through keys leftpos
and rightpos
for hlines and abovepos
and belowpos
for vlines,
\documentclass{article}
\usepackage{tabularray}
\usepackage{xcolor}
\begin{document}
Hlines ``in front of'' vlines\par
\begin{tblr}{
hlines={red, 4pt},
vlines={black, 4pt}
}
Alpha & Beta & Gamma & Delta \\
Epsilon & Zeta & Eta & Theta \\
Iota & Kappa & Lambda & Mu \\
\end{tblr}
\par\vspace{2em}
Vlines ``in front of'' hlines\par
\begin{tblr}{
hlines={red, 4pt, leftpos=0, rightpos=0},
vlines={black, 4pt, abovepos=1, belowpos=1} % seems `belowpos=1` is optional
}
Alpha & Beta & Gamma & Delta \\
Epsilon & Zeta & Eta & Theta \\
Iota & Kappa & Lambda & Mu \\
\end{tblr}
\end{document}
Thank you @muzimuzhi for the interesting workaround. Suppose that only some of the horizontal/vertical lines need to be shown with horizontal lines displayed using \hline[...]
or \cline[...]{...}
. How can that be achieved?
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{
vline{1}={1-2}{2pt, azure1},
vline{2}={1-Y}{2pt, azure3},
vline{3}={2-4}{2pt, azure5},
vline{4}={1-5}{2pt, azure7},
vline{5}={1-Z}{2pt, azure9},
} % more important case for me
Alpha & Beta & Gamma & Delta \\\cline[red,2pt]{1-3}
Epsilon & Zeta & Eta & Theta \\
Epsilon & Zeta & Eta & Theta \\\cline[red,2pt]{2-Z}
Epsilon & Zeta & Eta & Theta \\
Epsilon & Zeta & Eta & Theta \\
Iota & Kappa & Lambda & Mu \\\hline[red,2pt]
\end{tblr}
\end{document}
Since leftpos
and rightpos
are two of keys for hlines, and \hline[<hline keys>]
and \cline[<hline keys>]{<column selectors>}
both accept <hline keys>
as their optional argument, \hline[..., leftpos=n, rightpos=n]
and \cline[..., leftpos=n, rightpos=n]
are both supported.
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{
vline{1}={1-2}{2pt, azure1, abovepos=1, belowpos=1},
vline{2}={1-Y}{2pt, azure3, abovepos=1, belowpos=1},
vline{3}={2-4}{2pt, azure5, abovepos=1, belowpos=1},
vline{4}={1-5}{2pt, azure7, abovepos=1, belowpos=1},
vline{5}={1-Z}{2pt, azure9, abovepos=1, belowpos=1},
} % more important case for me
Alpha & Beta & Gamma & Delta \\ \cline[red,2pt,leftpos=0,rightpos=0]{1-3}
Epsilon & Zeta & Eta & Theta \\
Epsilon & Zeta & Eta & Theta \\ \cline[red,2pt,leftpos=0,rightpos=0]{2-Z}
Epsilon & Zeta & Eta & Theta \\
Epsilon & Zeta & Eta & Theta \\
Iota & Kappa & Lambda & Mu \\ \cline[red,2pt]{1-Z}
\cline[red,2pt,rightpos=0]{Z}
\end{tblr}
\end{document}
Thank you!
How can I Bringing vertical lines in front of the horizontal lines? The expected result is to have the black vertical lines on top of the red horizontal ones. I would appreciate a solution that could be used in
\hline[...]
or\cline[...]
.