With nicematrix
, you have an environment {NiceTabular}
constructed upon {tabular}
(of array
).
You can use the classical tools provided by array
for the rules.
You can use the classical packages which apply to the tabulars of LaTeX (eg: aryshln
for dashed rules).
{NiceTabular}
has a built-in command \hdottedline
and a letter :
for dotted rules (with dots which are true circles).
In fact, nicematrix
creates PGF/Tikz nodes under the cells, columns and rows of the environment, and so, it's possible to use Tikz to draw whatever rule you want (with the styles of Tikz).
However, you need several compilations (because nicematrix
uses PGF/Tikz nodes).
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\begin{NiceTabular}{|c:c|}
\hline
A & B \\
\hdottedline
C & D \\
\hline
\end{NiceTabular}
\bigskip
\begin{NiceTabular}{ccc}
A & B & C \\
E & F & G \\
H & I & J
\CodeAfter
\begin{tikzpicture}
\draw [dotted] (1-|1) -- (1-|4) ;
\draw [loosely dashed] (2-|1) -- (2-|4) ;
\draw [dash dot dot] (3-|1) -- (3-|4) ;
\draw [red, thick] (4-|1) -- (4-|4) ;
\draw [dotted] (1-|1) -- (4-|1) ;
\draw [loosely dashed] (1-|2) -- (4-|2) ;
\draw [dash dot dot] (1-|3) -- (4-|3) ;
\draw [red, thick] (1-|4) -- (4-|4) ;
\end{tikzpicture}
\end{NiceTabular}
\end{document}
![Output of the above code](https://cdn.statically.io/img/i.sstatic.net/KSsOj.png)