2

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}
2
\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}
  • 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}{})? – user2751530 May 7 '14 at 14:51
  • If you want to paint the town red try : \color{red}. – Tarass May 7 '14 at 14:55
  • 1
    Well, not that red, but thanks! – user2751530 May 7 '14 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 May 7 '14 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... – WeCanLearnAnything Sep 26 '15 at 20:09

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.