# How to set the width of column in longtable method?

Im trying to put a table in my document. it is bug in both width and height. So I need to use longtable, landscape and fixed width for the column. but I cant. Please help. I want this table fit in the page and if it is necessary, break it to 2 pages. Also I need the titles for columns be on their exact place. now they are not located on top of their columns.

here is the code:

\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

\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

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


You could combine the capabilities of the longtable and tabularx environments: The former environment lets tables span multiple pages, and the latter lets you specify overall widths of a table and provides a column type, X, that expands automatically to take up the available space. To combine these two environments, it's necessary to (i) load the ltxtable package as well, (ii) place the contents of the longtable material in an external file, and (iii) execute an LTXtable instruction that specifies the width of the table and the name of the file that contains the longtable stuff.

The driver file might look like this:

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


The file separate-longtable.tex should contain just the longtable-related material:

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

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

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

• @egreg - You're right. I'll remove the offending line. – Mico Jan 13 '14 at 11:57
• Thanks Mico for the reply. it shows error while compiling for caused by ltxtable package. .. here is the error (! LaTeX Error: Option clash for package geometry. ) . the error caused by \usepackage{ltxtable} – majed Jan 13 '14 at 17:39
• @majed - The MWE I posted does not generate any warning or error messages. (I checked the .log file.) Have you modified the code somehow? – Mico Jan 13 '14 at 19:58
• No I didnt . the only difference is that my driver file and the document that I want to put the table in it are different. I call the usepackages in the driver file. I mean this part: \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[margin=1in]{geometry} document's requirements \usepackage{longtable,tabularx,ltxtable} \usepackage{pdflscape} \usepackage{ragged2e} \newcolumntype{L}{>{\RaggedRight\arraybackslash}X} \newcolumntype{C}{>{\Centering\arraybackslash}X} – majed Jan 13 '14 at 20:09
• @majed - What happens if you either delete or comment out the string "document's requirements" from your preamble? – Mico Jan 13 '14 at 20:23