1

How can I make this style of table in Latex with a specific colour gradient in borders, for example from dark blue to light blue, the First horizontal two borders should look like that :

enter image description here

enter image description here

TTT
  • 47
  • 5
  • 1
    Welcome to TeX.SE! What you try so far? Can you show this? Recoding your table from scratch is not fun! – Zarko Jun 13 '21 at 10:24
  • 2
    Alternating row colors in a table can be achieved using the \rowcolors command which is accessible when adding \usepackage[table]{xcolor} to the preamble of a document. – leandriis Jun 13 '21 at 10:24
  • See https://tex.stackexchange.com/questions/598976/problem-with-table-latex/599321#599321 – Zarko Jun 13 '21 at 10:27
  • Is there any way that I can change the colour of borders, I mean with colour degradation ? – TTT Jun 13 '21 at 10:55
  • @TTT: What kind of borders are you referring to? In the screenshot you added to your question there are no colored borders, but just a colored background. Also, what does "colour degradation" refer to? Do you mean a colour gradient? – leandriis Jun 13 '21 at 12:06
  • Yes, I'm asking if there is a way to change the colour of borders from simple black to something like colour degradation (for example from dark blue to light blue) – TTT Jun 13 '21 at 12:18
  • @TTT You can define your own color by using xcolor.sty and the tag is \definecolor{colorone}{cmyk}{0.5,0.25,0,0.1} – MadyYuvi Jun 13 '21 at 13:33
  • Ok I will try this Thanks you – TTT Jun 13 '21 at 13:49

1 Answers1

2

Updated

Just a proof-of-concept, with the help of nicematrix package.

\documentclass{article}
\usepackage{enumitem} % for \tabularnote
\usepackage{nicematrix}
\usepackage{tikz}

\begin{document} \setlength{\arrayrulewidth}{5pt} % just for test

\begin{NiceTabular}[hlines]{cccc} 2 & 1 & 3 & 0 \ 3 & 3 & 1 & 0 \ 3 & 3 & 1 & 0% \tabularnote{default color} \end{NiceTabular}% \space \begin{NiceTabular}[hlines, rules/color=white]{cccc} 2 & 1 & 3 & 0 \ 3 & 3 & 1 & 0 \ 3 & 3 & 1 & 0% \tabularnote{axis-shading color} \CodeAfter \tikz{ \foreach \i in {1,...,\arabic{jCol}} { \fill[left color=blue!50!black, right color=blue!50] ([shift={(-.5\tabcolsep, -.5\arrayrulewidth)}] \i-|1) rectangle ([shift={(.5\tabcolsep, .5\arrayrulewidth)}] \i-|last); }; } \end{NiceTabular} \end{document}

enter image description here

Original answer

Here is a way combining the color series in xcolor package and the \arrayrulecolor, provided by colortbl package, to set color of horizontal rule in a tabular.

Check the corresponding package docs for more info.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}

\definecolorseries{tblrule}{rgb}{last}{blue!50!black}{blue!50}

\begin{document} \resetcolorseries[5]{tblrule} \setlength{\arrayrulewidth}{1pt}

\begin{tabular}{lr} \arrayrulecolor{tblrule!!+} \toprule a & b \ \midrule a & b \ \midrule a & b \ \midrule a & b \ \bottomrule \end{tabular} \end{document}

enter image description here

PS: Please keep the textual question description and the attached image for demonstration, as consistent as possible.

muzimuzhi Z
  • 26,474
  • Thanks you, but you have made it in a vertical way, can you make it horizontal with the gradient of colours of course, Thanks you – TTT Jun 13 '21 at 13:48
  • Ah, with your newly added image showing what the "colour gradient" means, I knew my answer hit the wrong target. I'm afraid that traditional table packages cannot do the trick directly, and I will check if nicematrix package is capable. – muzimuzhi Z Jun 13 '21 at 14:09
  • Hmmm, nicematrix's \hline makes use of \noalign as well, but not pgf drawing. – muzimuzhi Z Jun 13 '21 at 14:24
  • Yeah, I think it's for beamer right ? – TTT Jun 13 '21 at 14:41
  • @TTT Answer updated to show a proof-of-concept. And, nicematrix is a general package not only for beamer. – muzimuzhi Z Jun 13 '21 at 16:23