表格环境中的行颜色延伸至页面宽度

表格环境中的行颜色延伸至页面宽度

你好,我有以下表格环境:

\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}

但是,行颜色(在本例中定义为浅青色)似乎不受表格宽度的限制 - 它超出了边距。我是不是没有考虑到什么?显然,这不是我通常会注意到的事情,因为我创建的大多数表格都是白色背景,但为某些行添加颜色让我意识到背景颜色不受表格环境的限制。

答案1

第二列不允许换行,整个表格超出纸张大小,并延伸到右边距。例如,包tabularx有助于X实现允许换行并使用可用水平空间的列类型:

\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}

结果

相关内容