Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to reproduce a table like those in this picture

The table I want to reproduce

So far I have

\noindent
\begin{tabularx}{\textwidth}{| l | X | l | l | }
\hline
& Does the proposed research involve processing of genetic information or personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? & &  \\
\hline
& Does the proposed research involve tracking the location or observation of people? & &  \\
\hline
& I CONFIRM THAT NONE OF THE ABOVE ISSUES APPLY TO MY PROPOSAL  & YES & \\
\hline
\end{tabularx}

How can I get the white text on black background top row of the tables in the picture (which seems to be a three column row where the others are four columns)?. Also, is it possible to get something like the fine double line you see round the outside of the table and in fact all round the white on black top row of the table in the following higher resolution snapshot (click to enlarge):

enter image description here

share|improve this question
1  
Just note that it is (virtually) impossible to reproduce something if we can't see it. The description doesn't provide enough information as is. –  Werner Sep 27 '11 at 14:12
    
Yes, sorry about that. –  Raphael Sep 27 '11 at 14:32
    
Added a higher resolution picture that shows the lines. –  Raphael Sep 27 '11 at 19:02
    
I've updated my answer to include some reference to you (now visible) line specification. This is doable using the hhline package. The colortbl package documentation has some examples of this. –  Werner Sep 27 '11 at 19:09
add comment

3 Answers

up vote 8 down vote accepted

The idea is to use some of the commands provided by the table option of the xcolor package. The first option would be to use \rowcolor to specify the desired color for the whole row; however, since you need to use \multicolumn to override the default column specification (in order to have centered contents in some cells),the effect of \rowcolor will be lost, so it's better to use \cellcolor inside \multicolumn for the modified cells. The color for the text can be changed using the \textcolor (from the color package) command. These ideas can be better implemented through a new command. To get the fine double line, I used a \fbox (locally changing \fboxsep) to place a frame around the table, and a "fake" row; feel free to change the length according to your needs:

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

\newcommand\BlackCell[1]{%
  \multicolumn{1}{c|}{\cellcolor{black}\textcolor{white}{#1}}
}

\begin{document}

\begingroup
\noindent
\setlength\fboxsep{0.6pt}\fbox{%
\begin{tabularx}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}{| l | X | l | l | }
\hline
\BlackCell{} & \BlackCell{Research on Human Embryo/Foetus} & \BlackCell{YES} & \BlackCell{Page} \\\hline\multicolumn{4}{c}{}\\[-11.5pt]\hline
& Does the proposed research involve processing of genetic information or personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? & &  \\
\hline
& Does the proposed research involve tracking the location or observation of people? & &  \\
\hline
& I CONFIRM THAT NONE OF THE ABOVE ISSUES APPLY TO MY PROPOSAL  & YES & \\
\hline
\end{tabularx}%
}
\endgroup

\end{document}

enter image description here

share|improve this answer
    
The use of \cellcolor seems to be better, since it (from the embedded image) maintains the column rules. –  Werner Sep 27 '11 at 17:33
    
Thanks, that's perfect. –  Raphael Sep 27 '11 at 18:59
    
@Raphael Clifford: Since you have some responses that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). –  Gonzalo Medina Sep 27 '11 at 19:26
    
@Gonzalo Medina, All the answers were great but I have accepted this one as it is the one I have used. I haven't managed to get quite the effect I was looking for with \hhline yet but I did add the high resolution second picture a little late. –  Raphael Sep 28 '11 at 11:27
    
@Raphael Clifford: see my updated answer. –  Gonzalo Medina Sep 28 '11 at 15:18
show 3 more comments

Here is a mockup of what you might be after in terms of colouring the table row and text:

\documentclass{article}
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{colortbl}% http://ctan.org/pkg/colortbl
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{| l | X | l | l | }
\hline
\rowcolor{black!80} & \textcolor{white}{RESEARCH ON HUMANS} & \textcolor{white}{YES} & \textcolor{white}{Page} \\ \hline
& Does the proposed research involve processing of genetic information or personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? & &  \\
\hline
& Does the proposed research involve tracking the location or observation of people? & &  \\
\hline
& I CONFIRM THAT NONE OF THE ABOVE ISSUES APPLY TO MY PROPOSAL  & YES & \\
\hline
\end{tabularx}
\end{document}

enter image description here

You should read the colortbl package documentation to see what can be done in general. The inclusion of xcolor allows for shades of colours (like the 80% black I used - black!80).

The hhline package provides the means to draw (double) horizontal lines that have very neat intersections. Read the colortbl package documentation for some illustrations on how to incorporate colour and \hhline in a tabular(x) environment (section 9 More fun with \hhline).

share|improve this answer
    
Thanks. I will look up colortbl. –  Raphael Sep 27 '11 at 19:01
add comment

Please provide a full working example next time!

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

\begin{document}

\noindent
\def\arraystretch{1.3}
\begin{tabularx}{\textwidth}{| l | X | l | l | }\hline
\multicolumn{4}{@{}p{\dimexpr \textwidth-\tabcolsep}@{}}{\colorbox{black}{\parbox{\linewidth}{\color{white}%
 Does the proposed research involve processing of genetic information or personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? }}}\\\hline
 & Does the proposed research involve tracking the location or observation of people? & &  \\
\hline
& I CONFIRM THAT NONE OF THE ABOVE ISSUES APPLY TO MY PROPOSAL  & YES & \\
\hline
\end{tabularx}

\end{document}

enter image description here

share|improve this answer
    
Thanks very much. –  Raphael Sep 28 '11 at 9:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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