How to change hline thickness in tabular?

You can define your own \thickhline which is based on \hline, but with a different \arrayrulewidth:

enter image description here

\documentclass{article}

\makeatletter
\def\thickhline{%
  \noalign{\ifnum0=`}\fi\hrule \@height \thickarrayrulewidth \futurelet
   \reserved@a\@xthickhline}
\def\@xthickhline{\ifx\reserved@a\thickhline
               \vskip\doublerulesep
               \vskip-\thickarrayrulewidth
             \fi
      \ifnum0=`{\fi}}
\makeatother

\newlength{\thickarrayrulewidth}
\setlength{\thickarrayrulewidth}{2\arrayrulewidth}

\begin{document}

\begin{tabular}{ l | c | r }
  \hline
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  \hline
  7 & 8 & 9 \\
  \hline
\end{tabular}
\qquad
\begin{tabular}{ l | c | r }
  \thickhline
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  \hline
  7 & 8 & 9 \\
  \thickhline
\end{tabular}

\end{document}

In the above example, \thickhline inserts an \hrule that has a width double that of \arrayrulewidth. The latter has a default of 0.4pt. You can change \thickhline's width to whatever you want by adjusting \thickarrayrulewidth.


Three other possibilities:

  • the makecell package, in addition to allowing linebreaks in standard cells, defines the \Xhline and \Xcline commands which have the rule thickness as a mandatory argument.
  • the boldline package (from the shipunov bundle) defines \hlineB and clineB which take a numeric argument (how many times \arrayrulewidth, which defaults to 0.4pt). In addition, you can have varying thickness vertical rules, with V{some number} in the table preamble, in the place of |.
  • booktabs – which isn't really designed for that ;o) – allows to have thick horizontal rules compatible with vertical lines, with the \specialrule command, which takes three arguments: its thickness and the padding above and below. So I defined a shortcut for which the padding is set to 0. Advantage of booktabs: it's compatible with \arrayrulecolor whereas the first two are not.

Demo:

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

\begin{document}

\begin{tabular}{l!{\vline width 1pt}c | r }
  \arrayrulecolor{IndianRed} \Xhline{1pt}
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  \hline
  7 & 8 & 9 \\
  \Xhline{1pt}
\end{tabular}
\qquad
\begin{tabular}{ lV{2.5}c | r }
  \hlineB{2.5}
  1 & 2 & 3 \\
  \hline
  4 & 5 & 6 \\
  \hline
  7 & 8 & 9 \\
  \hlineB{2.5}
\end{tabular}
\qquad
\begin{tabular}{ 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{tabular}

\end{document}  

enter image description here