3

I'm using two custom table rules to reproduce the following table:

enter image description here

The codes below have problems at the edges, how to avoid the rules from producing extra spaces and extra length.

enter image description here

\documentclass{article}
\usepackage{array}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage{setspace}
\setstretch{1.5}
\DeclareMathOperator{\im}{im}

\makeatletter
\newcommand{\Lmidrule}{%
    \noalign {\ifnum 0=`}\fi \hrule height .55pt
    \futurelet \reserved@a \@xhline
}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width .65pt\hskip\tabcolsep}}
\makeatother

\makeatletter
\def\Cline#1#2{\@Cline#1#2\@nil}
\def\@Cline#1-#2#3\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height#3\hfill
  \cr}
\makeatother

\begin{document}

\begin{center}
\begin{tabular}{c"c"c"c"c"c"c"c"c}\toprule 
& $V_1$ & $V_2$ & $\cdots$ & $V_k$ & $V_{k+1}$ & $\cdots$ & $V_m$ 
\\\Lmidrule
& $\alpha_1$ & $\alpha_2$ & $\cdots$ & $\alpha_k$ &&&& 
\\\Cline{1-5}{.55pt}
\multirow{4}{*}{$\im T$} & $T\alpha_1$ & $T\alpha_2$ & $\cdots$ & $T\alpha_k$ &&&& 
\\
& $\vdots$ & $\vdots$ & & $\vdots$ &&&& $V/\ker T$
\\
& $T^{l_1-2}\alpha_1$ & $T^{l_2-2}\alpha_2$ & $\cdots$ & $T^{l_k-2}\alpha_k$&&&& 
\\\Cline{2-9}{.55pt}
& $T^{l_1-1}\alpha_1$ & $T^{l_2-1}\alpha_2$ & $\cdots$ & $T^{l_k-1}\alpha_k$ 
& $\alpha_{k+1}$ & $\cdots$ & $\alpha_m$ & $\ker T$ 
\\\bottomrule 
\end{tabular}
\end{center}

\end{document}

The custom rules are from:

How can I reproduce this table with thick lines?

Thick Lines on table

1
  • don't use booktabs with vertical rules. see the documentation for an explanation. note that this is by design: professional quality tables do not have vertical rules. (not that I think the booktabs position on this is a little extreme, personally, though I'm sympathetic to a moderated version of the claim.) Commented Oct 16 at 0:04

2 Answers 2

3

You could use the tabularray package. This makes it easy to add lines wherever you like:

\documentclass{article}

\usepackage{amsmath}
\usepackage{fourier}
\usepackage{setspace}
\setstretch{1.5}
\DeclareMathOperator{\im}{im}

\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}

\begin{center}
\begin{tblr}{
  cells={halign=c,mode=imath},
  hline{1,2,Z} = {1pt,solid},
  hline{3}={1}{1-5}{1pt,solid},
  hline{Y}={1}{2-Z}{1pt,solid},
  vline{2-X}={1pt,solid}
}
& V_1 & V_2 & \cdots & V_k & V_{k+1} & \cdots & V_m \\
& \alpha_1 & \alpha_2 & \cdots & \alpha_k &&&& \\
\SetCell[r=4]{} \im T & T\alpha_1 & T\alpha_2 & \cdots & T\alpha_k &&&& \\
& \vdots & \vdots & & \vdots &&&& V/\ker T \\
& T^{l_1-2}\alpha_1 & T^{l_2-2}\alpha_2 & \cdots & T^{l_k-2}\alpha_k&&&&  \\
& T^{l_1-2}\alpha_1 & T^{l_2-2}\alpha_2 & \cdots & T^{l_k-2}\alpha_k 
& \alpha_{k+1} & \cdots & \alpha_m & \ker T \\
\end{tblr}
\end{center}

\end{document}

enter image description here

3

Here is a solution with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage{setspace}
\usepackage{nicematrix,tikz}

\NiceMatrixOptions
  {
    custom-line =
     {
       letter = " ,
       ccommand = Cline ,
       tikz = {line width = 0.65 pt} ,
       total-width = 0.65 pt
     }
  }

\setstretch{1.5}
\DeclareMathOperator{\im}{im}

\begin{document}

\begin{center}
\begin{NiceTabular}{c"c"c"c"c"c"c"c"c}\toprule 
& $V_1$ & $V_2$ & $\cdots$ & $V_k$ & $V_{k+1}$ & $\cdots$ & $V_m$ 
\\ \midrule
& $\alpha_1$ & $\alpha_2$ & $\cdots$ & $\alpha_k$ &&&& 
\\\Cline{1-5}
\multirow{4}{*}{$\im T$} & $T\alpha_1$ & $T\alpha_2$ & $\cdots$ & $T\alpha_k$ &&&& 
\\
& $\vdots$ & $\vdots$ & & $\vdots$ &&&& $V/\ker T$
\\
& $T^{l_1-2}\alpha_1$ & $T^{l_2-2}\alpha_2$ & $\cdots$ & $T^{l_k-2}\alpha_k$&&&& 
\\\Cline{2-9}
& $T^{l_1-1}\alpha_1$ & $T^{l_2-1}\alpha_2$ & $\cdots$ & $T^{l_k-1}\alpha_k$ 
& $\alpha_{k+1}$ & $\cdots$ & $\alpha_m$ & $\ker T$ 
\\\bottomrule 
\end{NiceTabular}
\end{center}

\end{document}

Output of the above code

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.