1

In LaTeX, is it possible to set table alternative rule color i.e., first column background color GRAY then hline rule color WHITE(hline), if second column background color WHITE then hline rule color(gray)?enter image description here

MWE:

\documentclass[12pt,a4paper]{book} 
\usepackage{xcolor} 
\usepackage[table]{colortbl} 

\begin{document} 
\begin{table} 
\arrayrulecolor{red} 
\begin{tabular}{|l!{\color{blue}\vline}>{\columncolor[gray]{.8}}l!{\color{blue}\vline}l|} 
\hline 
NOUN &VERB &HOW YOU USE/APPLY EACH DOMAIN\\ 
\hline 
Knowledge &Remembering&\\ 
\hline 
Comprehension &Understanding&\\ 
\hline 
Application &Applying&\\ 
\hline 
Analysis &Analyzing&\\ 
\hline 
Synthesis &Creating and Evaluating&\\ 
\hline 
\end{tabular} 
\end{table} 
\end{document}
2

You could quickly get the table and this kind of customizations using the following editor: https://www.latex-tables.com; on the right of the page you can set the border colour.

Or try setting the color for each box, adapting a script like this:

\documentclass[12pt,a4paper]{book}
\usepackage{colortbl}
\usepackage{hhline}
\begin{document}

\begin{table}
\centering
\refstepcounter{table}
\label{t:test}
\arrayrulecolor[rgb]{0.753,0.753,0.753}
\begin{tabular}{llll}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{->{\arrayrulecolor{white}}->{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}->{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}->{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}->{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}->{\arrayrulecolor[rgb]{0.753,0.753,0.753}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t 
\end{tabular}
\arrayrulecolor{black}
\end{table}

% or black-white hhline:
\begin{table}
\centering
\refstepcounter{table}
\label{}
\arrayrulecolor{black}
\begin{tabular}{llll}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{->{\arrayrulecolor{white}}->{\arrayrulecolor{black}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor{black}}->{\arrayrulecolor{white}}->{\arrayrulecolor{black}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor{black}}->{\arrayrulecolor{white}}->{\arrayrulecolor{black}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor{black}}->{\arrayrulecolor{white}}->{\arrayrulecolor{black}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t  \\ 
\hhline{>{\arrayrulecolor{black}}->{\arrayrulecolor{white}}->{\arrayrulecolor{black}}->{\arrayrulecolor{white}}-}
t & {\cellcolor[rgb]{0.753,0.753,0.753}}e & s & {\cellcolor[rgb]{0.753,0.753,0.753}}t 
\end{tabular}
\arrayrulecolor{black}
\end{table}
\end{document}
  • In this case we created tables, but now issue was rule color will be changed depend upon background of cell color. – Rajesh N Dec 20 '18 at 5:37
  • I integrated the answer with an example of code; try to give a look. – Mi Ka El Dec 20 '18 at 13:04
  • Yes, I got output, exactly I needed this output, Thank you very much. – Rajesh N Dec 21 '18 at 7:18
  • If it was useful, you could upvote for the answer, thanks. – Mi Ka El Dec 21 '18 at 10:03
  • Any option for to put upvote in the site... – Rajesh N Dec 22 '18 at 6:06

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.