1

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

  • 2
    array and tabular are the same code apart from the fact that array cells are in math mode, why do you say your tabular version is impossible? – David Carlisle Feb 18 '18 at 18:30
  • I did not add the boldline package. Now I will use one (or more) of the suggested commands (the tip on the colored line is also very useful). Thanks – Intuition Digression Feb 18 '18 at 20:34
4

They all work within the array environment. Here is 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

  • I thank you very much. Excellent and very helpful answer. They all work indeed – Intuition Digression Feb 18 '18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.