[Tex/LaTex] thick line in array environment

arraysline

I am using an array environment, not tabular, which makes it impossible to use such commands as

\specialrule{.1em}{.05em}{.05em}

\Xhline{2\arrayrulewidth}

\noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline

for making line thicker. I have solved the problem with the vertical lines by using the command

\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}

and with the horizontal lines by using

\Xhline{1pt}

Is this correct or is there a better way?
I thank you very much

Carlo Alberto

Best Answer

They all work within the array environment. Here is a demo with makecell, boldline and booktabs. \cmidrule can even be used in the xmatrix environments:

    \documentclass{article}
    \usepackage{array, boldline, makecell, booktabs, amsmath}
    \newcommand\btrule[1]{\specialrule{#1}{0pt}{0pt}}
    \usepackage[svgnames, table]{xcolor}

    \begin{document}

  \[ \begin{array}{l!{\vline width 1pt}c | r }
      \arrayrulecolor{IndianRed} \Xhline{1pt}
      1 & 2 & 3 \\
      \hline
      4 & 5 & 6 \\
      \hline
      7 & 8 & 9 \\
      \Xhline{1pt}
    \end{array}
    \qquad
    \begin{array}{ lV{2.5}c | r }
      \hlineB{2.5}
      1 & 2 & 3 \\
      \hline
      4 & 5 & 6 \\
      \hline
      7 & 8 & 9 \\
      \hlineB{2.5}
    \end{array}
    \qquad
    \begin{array}{ l!{\color{IndianRed}\vline width 1pt}c | r }
      \arrayrulecolor{IndianRed}
      \btrule{1pt}
      1 & 2 & 3 \\
      \arrayrulecolor{black} \hline
      4 & 5 & 6 \\
      \hline
      7 & 8 & 9 \\
      \arrayrulecolor{IndianRed}\btrule{1pt}
    \end{array}
    \qquad
    \begin{bmatrix}
      1 & 2 & 3 \\
       \cmidrule(lr){1-3}
      4 & 5 & 6 \\
       \cmidrule(lr){1-2}
      7 & 8 & 9 \\
    \noalign{\setlength{\aboverulesep{-2ex}}
    \arrayrulecolor{IndianRed}\cmidrule(lr){1-3}
    \end{bmatrix}
\]
\end{document} 

enter image description here