使用 tabularx 和 longtable 的宽度和长表

使用 tabularx 和 longtable 的宽度和长表

这是我在乳胶中对表格的新手。我按照这里的例子如何用longtable方法设置列的宽度?以便使用longtabletabularx功能。

我想要一个既适合宽度页面又可以继续到下一页的表格。继续到第二页的表格应该包含标题“继续”和表格的头部。

我的驱动程序文件如下所示:

\documentclass[a4paper,twoside,11pt, times, numbered]{report}
\usepackage{longtable} %%For tables, that exceed one page
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltxtable}
\usepackage{pdflscape}
\usepackage{ragged2e}  


\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % flush-left, while allowing hyphenation
\newcolumntype{C}{>{\Centering\arraybackslash}X}   % centered,   while allowing hyphenation

\begin{document}
% Here is where my table begins
\begingroup % restrict scope of reset of \textwidth parameter
\setlength\textwidth\textheight
\begin{landscape}
\setlength\tabcolsep{2pt}
\tiny
\LTXtable{\textwidth}{macroinvertebratesIdx.tex} % name of file that contains my table
\end{landscape}
\endgroup

\end{document}

文件macroinvertebratesIdx.tex如下所示

\begin{longtable}{LLLLLL}

\caption{My caption}\\
\label{my-label}
 \hline
\multicolumn{2}{l}{Metric} & Taxonomic resolution & Definition & Expected response to increasing perturbation & Reference \\
\hline
\endhead
\multirow{5}{*}{Measures of richness} & Number of total taxa & \multirow{2}{*}{Family} & All different taxa at a site. & \multirow{11}{*}{Decrease} & \multirow{16}{*}{Resh \& Jackson, 1993; Barbour et al., 1999} \\
 & Number of EPT taxa &  & Total number of taxa of the orders Ephemeroptera (mayflies), Plecoptera (stoneflies) and Trichoptera (caddisflies). &  &  \\
 & Number of Ephemeroptera taxa & \multirow{3}{*}{Genus or Species} & Total number of taxa of the order Ephemeroptera (mayflies). &  &  \\
 & Number of Plecoptera taxa &  & Total number of taxa of the order Plecoptera (stoneflies). &  &  \\
 & Number of Trichoptera taxa &  & Total number of taxa of the order of Trichoptera (caddisflies). &  &  \\
\multirow{11}{*}{Enumerations} & Number of families in common & \multirow{9}{*}{Family} & Number of families in common between 2 samples. &  &  \\
 & \%EPT &  & Ratio of EPT abundance. &  &  \\
 & \%Ephemeroptera &  & Ratio of mayflies to total number of individuals. &  &  \\
 & \%Plecoptera &  & Ratio of stoneflies to total number of individuals. &  &  \\
 & \%Trichoptera &  & Ratio of caddisflies to total number of individuals. &  &  \\
 & \%Coleoptera &  & Ratio of individuals of the order of Coleoptera to total number of individuals. &  &  \\
 & \%Diptera &  & Ratio of individuals of the order of Diptera to total number of individuals. & \multirow{2}{*}{Increase} &  \\
 & \%Chironomidae &  & Ratio of chironomidae individuals to total number of individuals. &  &  \\
 & EPT / Chironomidae &  & Ratio of EPT abundance to chironomidae abundance. & Decrease &  \\
 & \% of most dominant genus & Genus & Ratio of individuals in numerically dominant genus to total numbers of individuals. & \multirow{2}{*}{Increase} &  \\
 & \% of dominant taxa & \multirow{4}{*}{Family} & Ratio of individuals in numerically dominant taxa to total number of individuals. &  &  \\
\multirow{6}{*}{Diversity and Similarity indices} & Shannon's Index &  & Description of community structure (Diversity). & Decrease & Shannon, 1948 \\
 & Simpson's Index &  & Diversity index commonly used in Ecology and Biology. & Increase & Simpson, 1949 \\
 & Margalef Index &  & Diversity index, where the number of species in the sample and the total number of organisms in the sampling are considered. & \multirow{7}{*}{Decrease} & Margalef, 1951 \\
 & Sequential Comparison Index (SCI) & Order or Family & Description of stream quality method, based upon distinguishing the number of different types of organisms and the number of « runs ». &  & Cairns et al., 1968 \\
 & Jaccard's Coefficient & \multirow{2}{*}{Family} & Description of the similarity between two samples. &  & Jaccard, 1901 \\
 & Sørensen Coefficient &  & Description of the similarity between two samples. &  & Sørensen, 1948 \\
\multirow{7}{*}{Biotic indices} & Trent Biotic Index (TBI) & Family (genus for Plecoptera and Ephemeroptera nymphs and species-level for Annelida, Mollusca, Crustacea and Megaloptera) & Description of the pollution level of streams, according to the sensitivity of key groups to pollution. &  & Woodiwiss, 1964; Metcalfe 1989 \\
 & Extended Biotic Index (EBI) & Family or Genus & Description of the pollution level of streams, according to the sensitivity of key groups to pollution. Aquatic ecosystems are described using « quality classes ». &  & Ghetti, 1997 \\
 & Beck Biotic Index (BI) & Genus & Classification of streams according to their organic pollution. Organisms are classed according to their tolerance to organic pollution. &  & Beck, 1955 \\
 & Family Biotic Index (FBI) & \multirow{10}{*}{Family} & Uses tolerance values to weight abundance in an estimate of overall pollution. Originally designed to evaluate organic pollution. & Increase & Hilsenhoff, 1982, 1988 ; Plafkin, 1989 \\
 & Biological Monitoring Working Party (BMWP) &  & Score system using benthic macroinvertebrate classed according to their pollution tolerance for Britain rivers. & \multirow{3}{*}{Decrease} & ISO, 1979 ; National Water Council, 1981 \\
 & Biological Monitoring Working Party – Costa Rica (BMWP/CR) &  & Score system based on the BMWP modified to include macroinvertebrate communities of Costa Rica &  & Gutiérrez-Fonseca and Lorion, 2014 \\
 & Biological Monitoring Working Party- Average Score per Taxon (BMWP- ASPT) &  & Average Score Per Taxon, added to the BMWP Score System. &  & Armitage et al., 1983 \\
\multirow{5}{*}{Functional Feeding measures} & \%Filterer collectors &  & Percent of the macrobenthos that filter fine organic material. & Increase & \multirow{5}{*}{Merrit \& Cummins, 2008} \\
 & \% Scrapers &  & Percent of the macrobenthos that feed on epiphytes. & \multirow{3}{*}{Decrease} &  \\
 & \%Shredder &  & Percent of the macrobenthos that feed on leaf litter. &  &  \\
 & \%Predators &  & Percent of the predator functional feeding group. They are carnivores-scavangers, engulf or pierce prey. &  &  \\
 & \% gathering collectors &  & Percent of the macrobenthos that collect fine deposited organic material. & Variable &  \\
Multimetric approach & IBI-west central Mexico &  & Computation of multimetric approaches which is summarized in a single value. & Decrease & Weigel et al., 2002

\end{longtable}

我只是找不到我做错的地方。请提供任何提示,使这项工作顺利进行,我将不胜感激。

答案1

您的列规范完全缺失,而且您还有一些非 ascii utf8 字符但未声明inputenc您也有\multirow未加载 multirow包的命令,但我删除了它们,因为它们似乎放错了位置。

在此处输入图片描述

\documentclass[a4paper,twoside,11pt, times, numbered]{report}
\usepackage{longtable} %%For tables, that exceed one page
\usepackage{booktabs}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{ragged2e}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}

\begin{landscape}
\begin{longtable}{
>{\RaggedRight\hspace*{0pt}}p{1.5cm}
>{\RaggedRight}p{3cm}
>{\RaggedRight}p{3cm}
>{\RaggedRight}p{4cm}
>{\RaggedRight}p{3cm}
>{\RaggedRight\arraybackslash}p{3cm}
}

\caption{My caption\label{my-label}}\\
 \hline
\multicolumn{2}{l}{Metric} & Taxonomic resolution & Definition & Expected response to increasing perturbation & Reference \\
\hline
\endfirsthead
\caption{My caption (continued}\\
 \hline
\multicolumn{2}{l}{Metric} & Taxonomic resolution & Definition & Expected response to increasing perturbation & Reference \\
\hline
\endhead
Measures of richness & Number of total taxa & Family & All different taxa at a site. & Decrease & Resh \& Jackson, 1993; Barbour et al., 1999 \\
 & Number of EPT taxa &  & Total number of taxa of the orders Ephemeroptera (mayflies), Plecoptera (stoneflies) and Trichoptera (caddisflies). &  &  \\
 & Number of Ephemeroptera taxa & Genus or Species & Total number of taxa of the order Ephemeroptera (mayflies). &  &  \\
 & Number of Plecoptera taxa &  & Total number of taxa of the order Plecoptera (stoneflies). &  &  \\
 & Number of Trichoptera taxa &  & Total number of taxa of the order of Trichoptera (caddisflies). &  &  \\
Enumerations & Number of families in common & Family & Number of families in common between 2 samples. &  &  \\
 & \%EPT &  & Ratio of EPT abundance. &  &  \\
 & \%Ephemeroptera &  & Ratio of mayflies to total number of individuals. &  &  \\
 & \%Plecoptera &  & Ratio of stoneflies to total number of individuals. &  &  \\
 & \%Trichoptera &  & Ratio of caddisflies to total number of individuals. &  &  \\
 & \%Coleoptera &  & Ratio of individuals of the order of Coleoptera to total number of individuals. &  &  \\
 & \%Diptera &  & Ratio of individuals of the order of Diptera to total number of individuals. & Increase &  \\
 & \%Chironomidae &  & Ratio of chironomidae individuals to total number of individuals. &  &  \\
 & EPT / Chironomidae &  & Ratio of EPT abundance to chironomidae abundance. & Decrease &  \\
 & \% of most dominant genus & Genus & Ratio of individuals in numerically dominant genus to total numbers of individuals. & Increase &  \\
 & \% of dominant taxa & Family & Ratio of individuals in numerically dominant taxa to total number of individuals. &  &  \\
Diversity and Similarity indices & Shannon's Index &  & Description of community structure (Diversity). & Decrease & Shannon, 1948 \\
 & Simpson's Index &  & Diversity index commonly used in Ecology and Biology. & Increase & Simpson, 1949 \\
 & Margalef Index &  & Diversity index, where the number of species in the sample and the total number of organisms in the sampling are considered. & Decrease & Margalef, 1951 \\
 & Sequential Comparison Index (SCI) & Order or Family & Description of stream quality method, based upon distinguishing the number of different types of organisms and the number of « runs ». &  & Cairns et al., 1968 \\
 & Jaccard's Coefficient & Family & Description of the similarity between two samples. &  & Jaccard, 1901 \\
 & Sørensen Coefficient &  & Description of the similarity between two samples. &  & Sørensen, 1948 \\
Biotic indices & Trent Biotic Index (TBI) & Family (genus for Plecoptera and Ephemeroptera nymphs and species-level for Annelida, Mollusca, Crustacea and Megaloptera) & Description of the pollution level of streams, according to the sensitivity of key groups to pollution. &  & Woodiwiss, 1964; Metcalfe 1989 \\
 & Extended Biotic Index (EBI) & Family or Genus & Description of the pollution level of streams, according to the sensitivity of key groups to pollution. Aquatic ecosystems are described using « quality classes ». &  & Ghetti, 1997 \\
 & Beck Biotic Index (BI) & Genus & Classification of streams according to their organic pollution. Organisms are classed according to their tolerance to organic pollution. &  & Beck, 1955 \\
 & Family Biotic Index (FBI) & Family & Uses tolerance values to weight abundance in an estimate of overall pollution. Originally designed to evaluate organic pollution. & Increase & Hilsenhoff, 1982, 1988 ; Plafkin, 1989 \\
 & Biological Monitoring Working Party (BMWP) &  & Score system using benthic macroinvertebrate classed according to their pollution tolerance for Britain rivers. & Decrease & ISO, 1979 ; National Water Council, 1981 \\
 & Biological Monitoring Working Party – Costa Rica (BMWP/CR) &  & Score system based on the BMWP modified to include macroinvertebrate communities of Costa Rica &  & Gutiérrez-Fonseca and Lorion, 2014 \\
 & Biological Monitoring Working Party- Average Score per Taxon (BMWP- ASPT) &  & Average Score Per Taxon, added to the BMWP Score System. &  & Armitage et al., 1983 \\
Functional Feeding measures & \%Filterer collectors &  & Percent of the macrobenthos that filter fine organic material. & Increase & Merrit \& Cummins, 2008 \\
 & \% Scrapers &  & Percent of the macrobenthos that feed on epiphytes. & Decrease &  \\
 & \%Shredder &  & Percent of the macrobenthos that feed on leaf litter. &  &  \\
 & \%Predators &  & Percent of the predator functional feeding group. They are carnivores-scavangers, engulf or pierce prey. &  &  \\
 & \% gathering collectors &  & Percent of the macrobenthos that collect fine deposited organic material. & Variable &  \\
Multimetric approach & IBI-west central Mexico &  & Computation of multimetric approaches which is summarized in a single value. & Decrease & Weigel et al., 2002

\end{longtable}
\end{landscape}


\end{document}

相关内容