1

Is there a way to have finer-grained control of vertical rules (along the lines of what cline permits for horizontal rules) in a NiceTabular environment?

E.g., I would like to eliminate the vertical line between "Semantic" and "Substantive" on the top right:

enter image description here

In a regular tabular environment, I would just use two multicolumn commands like \multicolumn{1}{l}{Semantic} & \multicolumn{1}{l}{Substantive}. Is there any way to replicate this in the NiceMatrix NiceTabular environment? MWE:

\begin{NiceTabular}{p{2.5cm}p{2.5cm}p{2.5cm}|p{2.5cm}}
&& \Block{1-2}{Subject}&\\
&& \textbf{Semantic} & \textbf{Substantive} \\
\cline{3-4}
\Block{2-1}{Justification} & \textbf{Semantic} & Surplusage & Common law \\
\cline{3-4}
& \textbf{Substantive} & Whole code & Lenity
\end{NiceTabular}

1 Answer 1

4

You can use an empty block which will prevent the vertical rule in the second row (the command \Block{1-2}{} below).

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{p{2.5cm}p{2.5cm}p{2.5cm}|p{2.5cm}}
&& \Block{1-2}{Subject}&\\
&& \Block{1-2}{}\textbf{Semantic} & \textbf{Substantive} \\
\cline{3-4}
\Block{2-1}{Justification} & \textbf{Semantic} & Surplusage & Common law \\
\cline{3-4}
& \textbf{Substantive} & Whole code & Lenity
\end{NiceTabular}

\end{document}

As usual with nicematrix, you need several compilations.

Output of the above code

You can also add the vertical rule as a border of an empty block (the command \Block[borders=right]{2-1}{} below).

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{p{2.5cm}p{2.5cm}p{2.5cm}p{2.5cm}}
&& \Block{1-2}{Subject}&\\
&& \textbf{Semantic} & \textbf{Substantive} \\
\cline{3-4}
\Block{2-1}{Justification} & \textbf{Semantic} & 
\Block[borders=right]{2-1}{}
Surplusage & Common law \\
\cline{3-4}
& \textbf{Substantive} & Whole code & Lenity
\end{NiceTabular}

\end{document}

The output is not exactly the same because, now, the rule is drawn after the construction of the array and no space is reserved for the vertical rule between the columns (3 & 4). Of course, that's only a difference of 0.4 pt.

Output of the second code

You can also draw with Tikz in the \CodeAfter: \CodeAfter \tikz \draw (3-|4) -- (last-|4); (of course this technic requires a minimal knowledge of Tikz).

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\begin{NiceTabular}{p{2.5cm}p{2.5cm}p{2.5cm}p{2.5cm}}
&& \Block{1-2}{Subject}&\\
&& \textbf{Semantic} & \textbf{Substantive} \\
\cline{3-4}
\Block{2-1}{Justification} & \textbf{Semantic} & 
Surplusage & Common law \\
\cline{3-4}
& \textbf{Substantive} & Whole code & Lenity 
\CodeAfter \tikz \draw (3-|4) -- (last-|4) ; 
\end{NiceTabular}

\end{document}

The output is the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .