How to change color of hline in LaTex

17,109

You need to use colortbl to colour the default tabular rules (horizontal or vertical):

enter image description here

\documentclass{article}
\usepackage{colortbl}

\begin{document}
\begin{tabular}{c}
  \arrayrulecolor{red}\hline
  a \\
  \arrayrulecolor{green}\hline
\end{tabular}
\end{document}
Share:
17,109
JonathanSFL
Author by

JonathanSFL

Updated on June 20, 2022

Comments

  • JonathanSFL
    JonathanSFL almost 2 years

    In a simple latex .tex file, how can i colorize an hline?

    I've tried

    \hline[color:red]
    

    ...and:

    \hline{color:red}     
    

    ...but they don't work

    Similarly, how can i increase the thickness (width) of the hline?

  • Maxim Pontyushenko
    Maxim Pontyushenko almost 9 years
    Can you make more detailed response by showing some code or what you did step-by-step?
  • dgilperez
    dgilperez over 8 years
    I'm seeing this error (although the file compiles): Misplaced \noalign. \hline ->\noalign. [...] I expect to see \noalign only after the \cr of an alignment. Proceed, and I'll ignore this case.