如何用longtable方法设置列的宽度?

如何用longtable方法设置列的宽度?

我正在尝试将表格放入我的文档中。它的宽度和高度都有问题。所以我需要使用长表、横向和固定宽度的列。但我做不到。请帮忙。我希望这个表格适合页面,如果有必要,将其分成 2 页。此外,我需要列的标题位于其准确的位置。现在它们不在列的顶部。

以下是代码:

\begin{landscape}
\tiny
\begin{center}
\begin{longtable}{|l|l|l|l|l|l|l|l|l|}\\


\caption[Feasible triples for a highly variable Grid]{Feasible triples for 
highly variable Grid, MLMMH.} \label{grid_mlmmh} \\

\multicolumn{1}{c}{System} & \multicolumn{1}{c}{Technology} & \multicolumn{1}{c}{Localization Method} & \multicolumn{1}{c}{Accuracy} & \multicolumn{1}{c}{Std RFID components} & \multicolumn{1}{c}{Indirect localization} & \multicolumn{1}{c}{Proximity detection}  & \multicolumn{1}{c}{applications} & \multicolumn{1}{c}{ST advantages}\\ 
\hline 
\endfirsthead


\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline 
\multicolumn{1}{c}{System} & \multicolumn{1}{c}{Technology} & \multicolumn{1}{c}{Localization Method} & \multicolumn{1}{c}{Accuracy} & \multicolumn{1}{c}{Std RFID components} & \multicolumn{1}{c}{Indirect localization} & \multicolumn{1}{c}{Proximity detection}  & \multicolumn{1}{c}{applications} & \multicolumn{1}{c}{ST advantages}\\ \hline 
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

RFID IoT[15] & Passive UHF RFID & Reader range & Reader range & Standard UHF RFID readers and tags & No    & No    & Tracking people’s behaviour & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & Fine grained localization. \\
RSSI RFID [5] & Passive  UHF RFID & RSSI  & ~ 1 m & Standard UHF RFID readers and tags & No    & No    & Localization & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & Fine grained localization. \\
Smart-home RFID [6] & Passive UHF RFID & Reader range & Reader range & Non standard RFID – mobile listeners, master and slave readers & No    & No among tags, slave and mobile readers have low range and can be used for proximity detection & Smart homes & [6] is just a conceptual solution that is more complex than ST-based RFID system \\
Ambient backscatter[10] & Passive technology & Ambient power harvesting and backscattering  & N/A – however it is possible to implement localization based on proximity & Non standard & N/A   & 2.5 ft proximity communication & Power harvesting IoT  & Relying on standard RFID components \\
Enhants [9] & UWB   & Non-RFID – power harvesting & N/A   & Non standard & N/A   & Yes – in the range of 1m to 10 m & Power harvesting IoT – the goal is to continuously locate and detect proximity & Relying on standard RFID components, \\
      &       &       &       &       &       &       &       & Localization \\
Holographic [11] & Passive UHF RFID & phase & < 50 cm & Standard UHFreader and tags – reader antenna moves at known trajectory & No    & No    & Localization & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & No need to move readers. \\
PDOA [13] & Passive UHF RFID & phase & < 1m  & Reader that provides phase & No    & No    & Localization & Allowing for proximity detection and limiting the range. \\
WISP with LEDS [14] & Passive UHF RFID, LEDs, camera & optical methods & <1 cm & Modified UHF tag, standard RFID reader, camera & No    & No between the tags. It can detect that two tags are located next to one another by the camera. &       & Much simpler system based on standard RFID tags. \\
Sherlock [12] & Passive UHF RFID, camera & cameras & ~1 m  & UHF RFID with steerable antennas and with cameras & No    & No    & Finding objects in the environment & Much simpler system based on only on RFID components, proximity detection \\
Hand-on RFID [8] & Passive HF RFID  & Proximity & N/A   & Standard HF RFID system & N/A   & Detecting touching of objects & Detection of daily activities & ST can be used for much more applications: localization, social interactions \\
Openbeacon [4] & Active RFID & Proximity and localization based on landmark & ~2m is reported. It can be much less if denser landmark tags are used & Non-standardized active RFID & Yes   & Yes < 1 m detection range & Social interaction, & Active tags are more expensive. For localiz., openbeacon tags need to replace batteries if used as landmark. \\
      &       &       &       &       &       &       & Location of people &  \\
ARR [3] & Passive UHF RFID & Proximity & N/A   & Standard UHF RFID with ARR & N/A   & Yes ~ 3 m detection range & Portal & ST can be used as both stationary and mobile tag while ARR is only stationary and it is more complex. \\
Gen 2 listener [7] & Passive UHF RFID & Proximity & N/A   & Gen2 Listener & N/A   & Yes ~ 12  m detection range & Protocol analyzer & Expensive hardware with GNU radio. Stationary compoenent. \\
Sense-a-Tag [1] & Passive UHF RFID & Proximity  & 30cm – depending of the density of landmark tags & Standard UHF RFID with ST & Yes   & Yes < 0.6 m detection range dependant of the distance from the reader & IoT based on standard UHF RFID: &  \\
      &       &       &       &       &       &       & Localization, &  \\
      &       &       &       &       &       &       & Proximity detection &  \\


\end{longtable}
\end{center}
\end{landscape}

答案1

longtable您可以结合和环境的功能tabularx:前者环境允许表格跨越多页,后者允许您指定表格的整体宽度并提供列类型,X它会自动扩展以占用可用空间。要结合这两个环境,需要 (i)ltxtable也加载包,(ii) 将 longtable 材料的内容放在外部文件中,以及 (iii) 执行LTXtable指定表格宽度和包含 longtable 内容的文件名称的指令。

驱动程序文件可能如下所示:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry} % set margins to suit your document's requirements
\usepackage{longtable,tabularx,ltxtable}
\usepackage{pdflscape} % for landscape environment
\usepackage{ragged2e}  % for \RaggedRight and \Centering macros
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % flush-left, while allowing hyphenation
\newcolumntype{C}{>{\Centering\arraybackslash}X}   % centered,   while allowing hyphenation

\begin{document}
\begingroup % restrict scope of reset of \textwidth parameter
\setlength\textwidth\textheight
\begin{landscape}
\setlength\tabcolsep{2pt}
\tiny
%\centering % longtables are centered automatically
\LTXtable{\textwidth}{separate-longtable.tex} % name of file that contains the table
\end{landscape}
\endgroup
\end{document}

该文件separate-longtable.tex应该只包含与 longtable 相关的材料:

\begin{longtable}{|*{9}{L|}}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for
highly variable Grid, MLMMH.} \label{grid_mlmmh} \\

\hline
\multicolumn{1}{|C|}{System} &
\multicolumn{1}{C|}{Technology} &
\multicolumn{1}{C|}{Localization Method} &
\multicolumn{1}{C|}{Accuracy} &
\multicolumn{1}{C|}{Std RFID components} &
\multicolumn{1}{C|}{Indirect localization} &
\multicolumn{1}{C|}{Proximity detection}  &
\multicolumn{1}{C|}{Applications} &
\multicolumn{1}{C|}{ST advantages}\\
\hline
\endfirsthead

\multicolumn{9}{l}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline
\multicolumn{1}{|C|}{System} &
\multicolumn{1}{C|}{Technology} &
\multicolumn{1}{C|}{Localization Method} &
\multicolumn{1}{C|}{Accuracy} &
\multicolumn{1}{C|}{Std RFID components} &
\multicolumn{1}{C|}{Indirect localization} &
\multicolumn{1}{C|}{Proximity detection}  &
\multicolumn{1}{C|}{Applications} &
\multicolumn{1}{C|}{ST advantages}\\
\hline
\endhead

\hline
\multicolumn{9}{r}{{Continued on next page}} \\
\endfoot

\hline \hline
\endlastfoot

RFID IoT[15] & Passive UHF RFID & Reader range & Reader range & Standard UHF RFID readers and tags & No    & No    & Tracking people's behaviour & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & Fine grained localization. \\
RSSI RFID [5] & Passive  UHF RFID & RSSI  & $\sim$ 1 m & Standard UHF RFID readers and tags & No    & No    & Localization & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & Fine grained localization. \\
Smart-home RFID [6] & Passive UHF RFID & Reader range & Reader range & Non standard RFID --- mobile listeners, master and slave readers & No    & No among tags, slave and mobile readers have low range and can be used for proximity detection & Smart homes & [6] is just a conceptual solution that is more complex than ST-based RFID system \\
Ambient backscatter [10] & Passive technology & Ambient power harvesting and backscattering  & N/A --- however it is possible to implement localization based on proximity & Non standard & N/A   & 2.5 ft proximity communication & Power harvesting IoT  & Relying on standard RFID components \\
Enhants [9] & UWB   & Non-RFID --- power harvesting & N/A   & Non standard & N/A   & Yes --- in the range of 1m to 10 m & Power harvesting IoT --- the goal is to continuously locate and detect proximity & Relying on standard RFID components, \\
      &       &       &       &       &       &       &       & Localization \\
Holographic [11] & Passive UHF RFID & phase & < 50 cm & Standard UHFreader and tags --- reader antenna moves at known trajectory & No    & No    & Localization & Allowing for proximity detection. \\
      &       &       &       &       &       &       &       & No need to move readers. \\
PDOA [13] & Passive UHF RFID & phase & < 1m  & Reader that provides phase & No    & No    & Localization & Allowing for proximity detection and limiting the range. \\
WISP with LEDS [14] & Passive UHF RFID, LEDs, camera & optical methods & <1 cm & Modified UHF tag, standard RFID reader, camera & No    & No between the tags. It can detect that two tags are located next to one another by the camera. &       & Much simpler system based on standard RFID tags. \\
Sherlock [12] & Passive UHF RFID, camera & cameras & $\sim$1 m  & UHF RFID with steerable antennas and with cameras & No    & No    & Finding objects in the environment & Much simpler system based on only on RFID components, proximity detection \\
Hand-on RFID [8] & Passive HF RFID  & Proximity & N/A   & Standard HF RFID system & N/A   & Detecting touching of objects & Detection of daily activities & ST can be used for much more applications: localization, social interactions \\
Openbeacon [4] & Active RFID & Proximity and localization based on landmark & $\sim$2m is reported. It can be much less if denser landmark tags are used & Non-standardized active RFID & Yes   & Yes < 1 m detection range & Social interaction, & Active tags are more expensive. For localiz., openbeacon tags need to replace batteries if used as landmark. \\
      &       &       &       &       &       &       & Location of people &  \\
ARR [3] & Passive UHF RFID & Proximity & N/A   & Standard UHF RFID with ARR & N/A   & Yes $\sim$ 3 m detection range & Portal & ST can be used as both stationary and mobile tag while ARR is only stationary and it is more complex. \\
Gen 2 listener [7] & Passive UHF RFID & Proximity & N/A   & Gen2 Listener & N/A   & Yes $\sim$ 12  m detection range & Protocol analyzer & Expensive hardware with GNU radio. Stationary compoenent. \\
Sense-a-Tag [1] & Passive UHF RFID & Proximity  & 30cm --- depending of the density of landmark tags & Standard UHF RFID with ST & Yes   & Yes < 0.6 m detection range dependant of the distance from the reader & IoT based on standard UHF RFID: &  \\
      &       &       &       &       &       &       & Localization, &  \\
      &       &       &       &       &       &       & Proximity detection &  \\

\end{longtable}

相关内容