# Fully Customized Table in Latex

Is it possible to have a customized table in LaTeX that has the following features?

1. Be able to define Width and/or Height for specific row/column
2. Be able to highlight/color a specific row or column or a cell
3. Be able to align horizontally and/or vertically the columns/rows

This is waht I have been using so far for individual features:

For the feature #1: http://www.sascha-frank.com/Faq/tables_six.html

For the feature #2: http://texblog.org/2011/04/19/highlight-table-rowscolumns-with-color/

For the feature #3: https://tex.stackexchange.com/a/46393

But I couldn't manage to make one piece of code that can adjust all of these features together. Is this possible in LaTeX? Thanks in advance.

EDIT:

So for example I use this code to have a table that I can specify width of the columns and change the color of a specific row and/or column:

\documentclass[a4paper]{article}

\usepackage{array}

% to change color of row and column
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}

\begin{document}

\newcolumntype{a}{>{\columncolor{mColor1}}l}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\begin{table}[h]
\caption{table}
\centering
\begin{tabular}{| a | L{1.2cm} | C{1.5cm} | R{3cm} |}
\hline
\rowcolor{mColor1}
1 & 2 \newline 2.1 & 3 & 4 \\
\hline
1 & 2 & 3 & 4 \\
\hline
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{table}

\end{document}


However, I don't know:

1. How to change the color of a column that has a specific width size (how to use color and size together)?
2. How to specify height of a row? and be able to change its color?
3. How to change the vertical and horizontal alignments for the columns/row that has specific color and size?

• Yes, this is all possible. Please provide a specific, complete example of the code for something you have tried so we can help you on the part you're having trouble with. Otherwise the question is too broad for us to answer. – musarithmia Jan 16 '15 at 22:11
• sure, i'll edit my question in a minute. – NESHOM Jan 16 '15 at 22:14
• Question 2 ("How to specify size of a row") is still unclear to me. What do you want to do exactly? Change the height of the row? Change the total length of a row so this row has a different length than all other rows? – Gonzalo Medina Jan 16 '15 at 22:40
• sorry, I meant height of a row. I modified the question. – NESHOM Jan 16 '15 at 22:50
• Note that this site has a format which works on a one-question-per... well, per-question basis. If three different people give you answers, whose will you accept? – cfr Jan 17 '15 at 0:33

Re. 1 and part of 3:

You can use

  \newcolumntype{Q}[2][mColor1]{>{\columncolor{#1}\raggedright\arraybackslash}p{#2}}% takes 1 optional and 1 required argument
\newcolumntype{B}[2]{>{\columncolor{#1}\centering\arraybackslash}p{#2}}% takes 2 required arguments
\newcolumntype{S}[1]{>{\columncolor{mColor1}\raggedleft\arraybackslash}p{#1}}


in place of L, C and R for similar columns in your chosen colour.

• Thanks, can we have second input for the color? I mean if I want to have two different columns with two different colors using your method, I have to use another \newcolumntype. Is it possible to define one \newcolumntype that takes width and color as two inputs? – NESHOM Jan 17 '15 at 2:27
• @NESHOM See edited answer. It is just \newcommand, so I think this should work. – cfr Jan 17 '15 at 3:37