2

I am trying to color the following table:

\begin{tabular}{ |c|c|c|c|c| }
\hline
1,5h&               0,25h&   13h&    0,25h& 0,5h \\ \hline
Flight preparation& Taxiing& Flight& Taxiing&   Flight debrief \\ \hline
&   \multicolumn{3}{|c|}{Block time}&   \\ \hline
\multicolumn{5}{|c|}{Duty time} \\  \hline
\end{tabular}

Goal:

  1. To make the cell "BLOCK TIME" in the color yellow.
  2. To make the cell "DUTY TIME" in green.

Please note, I do not want to color a complete row or column. Just the CELL!

3

You can just load the xcolor package and use \cellcolor{color}.

enter image description here

\documentclass{article}
\usepackage[table]{xcolor}    % loads also »colortbl«

\begin{document}

\begin{tabular}{ |c|c|c|c|c| }
\hline
1,5h&               0,25h&   13h&    0,25h & 0,5h \\ \hline
Flight preparation& Taxiing& Flight& Taxiing&   Flight debrief \\ \hline
&  \multicolumn{3}{|c|}{\cellcolor{yellow} Block time} &   \\ \hline
\multicolumn{5}{|c|}{\cellcolor{green}  Duty time} \\  \hline
\end{tabular}

\end{document}
  • or just colortbl:-) – David Carlisle Jan 9 '14 at 16:43
  • @DavidCarlisle You're right... Never thought about that: is loading just the other package better? I feel like loading too much if this includes multiple purposes... and thanks! – Alenanno Jan 9 '14 at 16:44
  • 1
    No xcolor is a nice package and probably people using colour will use it anyway and no one but me minds which package defines which feature, but \cellcolor comes from colortbl:-) (actually it was Donald Arseneau who suggested it) – David Carlisle Jan 9 '14 at 16:46
  • @DavidCarlisle I see. Thanks for the info! :) – Alenanno Jan 9 '14 at 16:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.