0

Suppose I have a 4 x 4 table that was created in the tabular environment. I want to outline the borders of the 3 x 3 sub-table that sits in the lower right corner in a color that is different from the lines that separate the cells in the other parts of the table. Is there a relatively easy way to do this?

1 Answers1

1

One way is as below with the fit library -- the horizontal and verticals have been removed for clarity -- you could set them back

enter image description here

\documentclass{article}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,fit}
\begin{document}

\begin{tabular}{cccc} %\hline 1 & {3} & 2& B\ %\hline A & \tikzmarknode{B1}B& {C}& B\ %\hline D & E & K&{B} \ %\hline G & H & I& \tikzmarknode{B2}B\ %\hline \end{tabular} \begin{tikzpicture}[overlay,remember picture] \node[ draw=blue,line width=2pt,fit={(B1)(B2)($(B1.north west)+(-2pt,-0pt)$)($(B2.south east)+(2pt,-0pt)$)}]{}; \end{tikzpicture} \end{document}

js bibra
  • 21,280