2

I can make the following table:

enter image description here

\documentclass{article}

\usepackage{geometry} 

\usepackage{xcolor} 

\usepackage{amsmath}

\begin{document}

\begin{center}

\begin{tabular}{|c||c|c||c|c||c|c||c|c||c|c||c|c|}

\hline

Caixa & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ \\

\hline

10&10&1&10&1&10&1&10&1&10&0&0&1\\

\hline

9&8&1&8&1&8&1&8&1&8&1&9&1\\

\hline

8&6&1&6&1&6&1&6&1&6&1&7&1\\

\hline

7&4&1&4&1&4&1&4&1&4&1&5&1\\

\hline

6&2&1&2&1&2&1&2&1&2&1&3&1\\

\hline

5&0&1&5&2&5&2&5&2&5&2&1&1\\

\hline

4&2&2&1&2&1&2&1&2&1&2&3&2\\

\hline

3&1&3&0&3&0&3&3&3&3&4&2&3\\

\hline

2&1&6&0&6&2&7&1&7&1&7&2&0\\

\hline

1&1&17&1&19&1&2&1&2&1&21&1&17\\

\hline

\textbf{TOTAL}&35&&37&&39&&39&&41&&33&\\

\hline

\end{tabular}

\end{center}

\end{document}

But I would like to paint the columns as shown in the figure.

enter image description here

  • You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. – Andrew Dec 2 '16 at 0:45
  • You can use xcolor to color the cells of a table. See How to make a visually good table for an example. – Andrew Dec 2 '16 at 0:47
  • 1
    before you will going to coloring table, see wiert.me/2014/04/03/… – Zarko Dec 2 '16 at 0:48
  • Andrew - In the example suggested, are colored lines. I think I know how to do. But, paint only the columns I can't yet. – benedito Dec 2 '16 at 0:51
4

Her is a solution: it uses the colortbl package, loaded by xcolorwith option[table]. I also usedhhlinefor nicer-looking horizontal lines (in my opinion) and I added some vertical padding to the rows withextrarowheight`: \documentclass{article}

\usepackage{geometry}

\usepackage[table, x11names]{xcolor}

\usepackage{array, hhline, amsmath}

\begin{document}

\begin{center}
\setlength\extrarowheight{3pt}
\begin{tabular}{|c|*{6}{|>{\columncolor{OliveDrab3!60}}c|>{\columncolor{Yellow1!80}}c|}}

\hhline{|-|*{6}{|--|}}

Caixa & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ & $a_{i}$&$n_{i}$ \\

\hhline{|-|*{6}{|--|}}

10&10&1&10&1&10&1&10&1&10&0&0&1\\

\hhline{|-|*{6}{|--|}}

9&8&1&8&1&8&1&8&1&8&1&9&1\\

\hhline{|-|*{6}{|--|}}

8&6&1&6&1&6&1&6&1&6&1&7&1\\

\hhline{|-|*{6}{|--|}}

7&4&1&4&1&4&1&4&1&4&1&5&1\\

\hhline{|-|*{6}{|--|}}

6&2&1&2&1&2&1&2&1&2&1&3&1\\

\hhline{|-|*{6}{|--|}}

5&0&1&5&2&5&2&5&2&5&2&1&1\\

\hline

4&2&2&1&2&1&2&1&2&1&2&3&2\\

\hhline{|-|*{6}{|--|}}

3&1&3&0&3&0&3&3&3&3&4&2&3\\

\hhline{|-|*{6}{|--|}}

2&1&6&0&6&2&7&1&7&1&7&2&0\\

\hhline{|-|*{6}{|--|}}

1&1&17&1&19&1&2&1&2&1&21&1&17\\

\hhline{|-|*{6}{|--|}}

\textbf{TOTAL}&35&&37&&39&&39&&41&&33&\\

\hhline{|-|*{6}{|--|}}

\end{tabular}

\end{center}

\end{document} 

enter image description here

  • Bernard - Perfect! Show! – benedito Dec 2 '16 at 1:08

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.