3

I have a document full of tables (think 8-10 tables) - already written. Some are tabulars, others are longtables. I do not want to substantially change the existing code.

What is the fastest way (in terms of markup) to convert the colors of border and frame lines from black to a specified color? I have xcolor loaded?

This is for a class file, and if a single redefinition of the internals of tabular or longtable could do it, that would be perfect.

MWE:

\documentclass{article}
\usepackage{longtable}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\lipsum[1]

\begin{tabular}{llll}\hline
Some & Thing & Here & Now \\\hline
1 & 2 & 3 & 4 \\\hline
\end{tabular}

\lipsum[2]
\begin{longtable}[l]{|p{2.5cm}|p{5.5cm}|p{6cm}} \hline
Word & Play & Table \\\hline
This & is & now \\\hline
That & was & then \\\hline
\end{longtable}

\lipsum[2]

\end{document}

1 Answer 1

3
\documentclass{article}
\usepackage{longtable}
\usepackage{xcolor,colortbl} % <---
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\arrayrulecolor{red} % <---

\lipsum[1]

\begin{tabular}{llll}\hline
Some & Thing & Here & Now \\\hline
1 & 2 & 3 & 4 \\\hline
\end{tabular}

\lipsum[2]
\begin{longtable}[l]{|p{2.5cm}|p{5.5cm}|p{6cm}} \hline
Word & Play & Table \\\hline
This & is & now \\\hline
That & was & then \\\hline
\end{longtable}

\lipsum[2]

\end{document}
5
  • Thanks! That works. Now, is there an easy way to do the same to any \rule{} lines in the document, and to all text (short of enclosing each block of text in \textcolor{color1}{})? Commented May 7, 2014 at 14:51
  • If you want to paint the town red try : \color{red}.
    – Tarass
    Commented May 7, 2014 at 14:55
  • 1
    Well, not that red, but thanks! Commented May 7, 2014 at 15:39
  • Could you be more specific in your question on what you want to change. Maybe you can ask an new question with a minimal example saying this in red, this in blue ...
    – Tarass
    Commented May 7, 2014 at 15:43
  • I just tried this. It gave me two error messages. (1) "!LaTeX Error: Option clash for package xcolor." What does this mean and how might I fix it? and (2) "Undefined color 'ProcessBlue'. See the xcolor package documentation..." This color worked fine right before... Commented Sep 26, 2015 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .