2

Hi I have the following tabular environment:

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage{setspace}
\onehalfspacing
\usepackage[english]{babel}
\usepackage{grffile}
\usepackage{fancyhdr}
\usepackage{epsfig}
\usepackage[options]{algorithm2e}
\usepackage{filecontents}% http://ctan.org/pkg/filecontents
\usepackage{listings}% http://ctan.org/pkg/listings
\usepackage{hyperref}
\pagenumbering{arabic}
\newcounter{qcounter}
\let\centering\relax
\usepackage{color, colortbl}
\definecolor{name}{system}{definition}
\definecolor{Gray}{gray}{0.9}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\usepackage{caption}
\usepackage{tikz}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{fancybox}
\MakeOuterQuote{"}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb}

\begin{document}

\begin{table}[H]
\begin{tabular}{l|l}
& Landmarks in the Human Genome Project \\
\hline
\rowcolor{LightCyan}
1953& Watson-Crick publish DNA structure \\
1975& F.Sanger, A.Maxam and W.Gilbert develop methods for sequencing DNA \\
\rowcolor{LightCyan}
1977& Bacteriophage $\Phi X -174$ sequenced: first complete genome sequenced \\
1980& US Supreme court rules genetically modified bacteria are pantentable \\
\rowcolor{LightCyan}
1981& Human mitochondrial DNA sequenced: $16569$ base pairs \\
1984& Epstein-Barr virus genome sequenced: 172,281 base pairs\\
\rowcolor{LightCyan}
1990& International Human Genome Project launched \\
1991& J. Craig Venter identifies sequences of DNA complementary to messenger RNA \\
\rowcolor{LightCyan}
1992& Complete low resolution linkage map of the human genome \\
1992& \textit{Caenorhabditis} sequencing project begins \\
\rowcolor{LightCyan}
1992& J. Craig Venter forms the Institute for Genome Research (TIGR) \\
1992& Wellcome Trust and UK Medical Research Council establish The Sanger Center for large-scale genomic sequencing  & & & & & &\\
\rowcolor{LightCyan}
1995& First complete sequence of bacterial genome, \textit{Haemophilus influenzae} by TIGR \\
1996& High resolution map of human genome\\
\rowcolor{LightCyan}
1996& Completion of yeast genome, first eukaryotic genome sequence \\
1996& Celera claims to finish sequencing human genome by 2001, Wellcome Trust respond by increasing funding to the Sanger Center\\
\rowcolor{LightCyan}
1998& \textit{Caenorhabdtis elegans} genome published  \\
1998& \textit{Drosophila melanogaster} genome published  \\
\rowcolor{LightCyan}
1999& Human Genome project says it will sequence human genome with 2 years \\
1999& Sequence of first human chromosome published \\
\rowcolor{LightCyan}
2001& Joint announcement of complete sequence of human genome\\
\hline
\end{tabular}
\end{table}

\end{document}

however, the row colour (in this case defined as light cyan) does not seemed to be constrained by the width of the table - it caries on past the margin. Is there something I am not taking into account here? Obviously this isn't something I would normally notice given that most tables I create are white background, but adding in the colour for certain rows has made me realise the background colour isn't constrained to the table environment.

  • I cannot reproduce the problem with the given code snippet. Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Heiko Oberdiek Jan 27 '14 at 14:48
  • @Heiko Oberdiek sorry yes, have updated my question. – brucezepplin Jan 27 '14 at 14:54
  • unrelated but unless you need to emulate a LaTeX2.09 document from 1985 you don't want the epsfig package, and [H] if you don't float the float package specifies that the float may not be placed anywhere so that float and all following ones will go to end of document. – David Carlisle Jan 27 '14 at 16:48
5

The second column does not allow line breaks and the whole table is sticking into the right margin beyond the paper size. For example, package tabularx helps with a column type X that allows line breaks and uses the available horizontal space:

\documentclass[12pt]{article}
\usepackage{color, colortbl}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\usepackage{tabularx}

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{l|X}
& Landmarks in the Human Genome Project \\
\hline
\rowcolor{LightCyan}
1953& Watson-Crick publish DNA structure \\
1975& F.Sanger, A.Maxam and W.Gilbert develop methods for sequencing DNA \\
\rowcolor{LightCyan}
1977& Bacteriophage $\Phi X -174$ sequenced: first complete genome sequenced \\
1980& US Supreme court rules genetically modified bacteria are pantentable \\
\rowcolor{LightCyan}
1981& Human mitochondrial DNA sequenced: $16569$ base pairs \\
1984& Epstein-Barr virus genome sequenced: 172,281 base pairs\\
\rowcolor{LightCyan}
1990& International Human Genome Project launched \\
1991& J. Craig Venter identifies sequences of DNA complementary to messenger RNA \\
\rowcolor{LightCyan}
1992& Complete low resolution linkage map of the human genome \\
1992& \textit{Caenorhabditis} sequencing project begins \\
\rowcolor{LightCyan}
1992& J. Craig Venter forms the Institute for Genome Research (TIGR) \\
1992& Wellcome Trust and UK Medical Research Council establish The Sanger Center for large-scale genomic sequencing\\
\rowcolor{LightCyan}
1995& First complete sequence of bacterial genome, \textit{Haemophilus influenzae} by TIGR \\
1996& High resolution map of human genome\\
\rowcolor{LightCyan}
1996& Completion of yeast genome, first eukaryotic genome sequence \\
1996& Celera claims to finish sequencing human genome by 2001, Wellcome Trust respond by increasing funding to the Sanger Center\\
\rowcolor{LightCyan}
1998& \textit{Caenorhabdtis elegans} genome published  \\
1998& \textit{Drosophila melanogaster} genome published  \\
\rowcolor{LightCyan}
1999& Human Genome project says it will sequence human genome with 2 years \\
1999& Sequence of first human chromosome published \\
\rowcolor{LightCyan}
2001& Joint announcement of complete sequence of human genome\\
\hline
\end{tabularx}

\end{document}

Result

  • thanks Heiko - did not know about the tabularx package – brucezepplin Jan 27 '14 at 15:32

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.