Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I change the color of the lines (the frame) in a tabular environment? In the following MWE:

\begin{tabular}{c|c|c}
a&b&c \\ \hline
d&e&f \\ \hline
g&h&i
\end{tabular}

I would like the horizontal and vertical lines of the table to have, say a blue color.

share|improve this question
    
    
yes, the answer is there :) –  nicolas roy Jan 10 '12 at 19:08
add comment

2 Answers

up vote 16 down vote accepted

You can use the colortbl package for this. It works as follows:

\documentclass{article}
\usepackage{colortbl}
\begin{document}
  \begin{tabular}{l!{\color{green}\vrule}l}
    \arrayrulecolor{red}\hline
    test & test\\\arrayrulecolor{blue}\hline
  \end{tabular}
\end{document}

Looks like this:

Array with coloured rules

share|improve this answer
9  
Or the xcolor package with the table option (internally loading colortbl and giving access to the full xcolor capacity). –  Gonzalo Medina Jan 10 '12 at 16:08
1  
the command \arrayrulecolor{red} is exactly what i need. –  nicolas roy Jan 10 '12 at 19:09
add comment

The tabu package could also be helpful here.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{tabu}

\begin{document}
  \taburulecolor{blue}
  \begin{tabu}{c|c|c}
    a & b & c \\ \hline
    d & e & f \\ \hline
    g & h & i
  \end{tabu}
\end{document}
share|improve this answer
    
i voted for wh1t3's solution, because, i need this in a very long document, with many tabular that are already written, and i don't want to change the environment. But the package tabu seems looks very interesting. Thank you –  nicolas roy Jan 10 '12 at 19:11
1  
@nicolasroy: You can still upvote Thorsten's answer as well of course. –  Roelof Spijker Jan 10 '12 at 19:36
    
i've have been fighting in understanding how ot officially registerd in this forum... precisely with this purpose :) –  nicolas roy Jan 10 '12 at 20:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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