1

I'm writing an article and the template is a two-column text. I have this table:

\documentclass[conference]{IEEEtran}

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{siunitx}
\usepackage[bottom]{footmisc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{longtable}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{xtab,booktabs}
\usepackage{booktabs, makecell, ltablex, threeparttablex}

\begin{document}

\begin{longtable}{|C{0.08\linewidth}|C{0.28\linewidth}|C{0.35\linewidth}|} 
\hline 
\textbf{Type} & \textbf{Quantity} & \textbf{Name/Model/Brand} \\
\hline 
\endfirsthead 
\hline 
\textbf{Type} & \textbf{Quantity} & \textbf{Name/Model/Brand}\\
\hline 
\endhead

\thead{S/T} & \thead{Temperature \\ and Humidity} & \thead{Phidgets Humidity \\ and Temperature Sensor}  \\
\hline
S/T&Temperature&D600 \\
\hline
S/T&\thead{Temperature \\ and Humidity}&AM2315 \\
\hline
S/T&\thead{Temperature \\ and Humidity}&SHT11 \\
\hline
S/T&\thead{Temperature \\ and Humidity}&AM2321 \\
\hline
S/T&\thead{Temperature \\ and Humidity}&Testo 175H1 \\
\hline
S/T&Temperature&\thead{Type-K Stainless \\ Steel Thermocouple} \\
\hline
A&Temperature&\thead{Thermostatic PTC \\ heating element} \\
\hline
A&Temperature&\thead{KippKitts \\ cooling unit} \\
\hline
A&\thead{Temperature, air flow, \\ and humidity}&Sunon KD1208PTS1 \\
\hline
A&Soil moisture&\thead{Control servo \\ ES08AII} \\
\hline
A&Soil moisture&\thead{Homecube peristaltic \\ liquid pumps} \\
\hline
S/T&Water level and soil moisture&VG400-LV \\
\hline
S/T&Water level&LLE102000 \\
\hline
A&Air humidity&\thead{Phtronics portable \\ bottle cap air \\humidifier with \\bottle} \\
\hline
A&Luminosity&GE light modules \\
\hline
A&Luminosity&\thead{Full spectrum Compact \\Fluorescent Light \\grow light} \\
\hline
A&pH&\thead{General Hydroponics \\liquid bottles and \\FloraDuo fertilizers} \\
\hline
S/T&Air humidity&HIH-4010 \\
\hline
S/T&Luminosity&\thead{Phidgets Light \\Sensor 70000 lux} \\
\hline
S/T&Luminosity&ADPS-9002 \\
\hline
S/T&Luminosity&Adafruit TSL2561 \\
\hline
S/T&Luminosity&NJL7502L \\
\hline
S/T&pH&Atlas pH sensor \\ 
\hline
S/T&pH&Phidgets pH/ORP Adapter \\
\hline
S/T&Soil moisture&FC-28 \\
\hline
S/T&Soil moisture&ECH2O EC-5 \\
\hline
S/T&Air flow&\thead{Testo 435-4 hot \\wire anemometer \\ + 0635 1535 thermal \\ velocity probe}  \\
\hline
S/T&Pressure&NPP-301 \\
\hline
S/T&Electric conductivity&Atlas EC \\
\hline
S/T&Water level&DS18B29\\
\hline
S/T&Image&\thead{ELP 5 Megapixel\\ USB camera}\\
\hline
S/T&Irradiation&\thead{International Light \\Technologies \\Spectroradiometer\\ ILT950 I}\\
\hline
S/T&$CO_{2}$ concentration&MHZ16\\
\hline
A&Soil moisture&Water pump (generic)\\
\hline
A&\thead{Temperature, air flow, \\ and humidity}&Fan (generic)\\
\hline
A&\thead{Temperature and \\luminosity}&Light bulb (generic)\\
\hline
A&Humidity&Humidifier (generic)\\
\hline
A&\thead{Luminosity and \\ air flow}&DC motor (generic)\\
\hline
A&Luminosity&UV LED lamp (generic)\\
\hline
A&Air flow&DC blower (generic)\\
\hline
A&Oxygenation&Air pump (generic)\\
\hline

\end{longtable} 

\end{document}

When I compile the document, this is what I get:

the first part of the table is on the first column of a page and the second part of the table is on the second column of the next page. How can I have these parts side by side, on the same page?

3
  • Your example does not compile.
    – hesham
    Apr 27, 2020 at 2:38
  • @hesham I added some packages I forgot. Could you try again? Apr 27, 2020 at 2:45
  • 1
    When you compiled the document, did you notice the error (not warning) message "Package longtable Error: longtable not in 1-column mode"?
    – Mico
    Apr 27, 2020 at 4:38

1 Answer 1

3

The longtable environment can not be used properly in a two-column document. Instead, use an xtabular environment, which is provided by the xtab package.

Oh, I've removed all \thead wrappers, as none of them would seem to be required.

enter image description here

\documentclass[conference]{IEEEtran}
\usepackage{showframe}
\usepackage{cite}
\usepackage{amsmath,amssymb}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{siunitx}
\usepackage[bottom]{footmisc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{longtable,xtab,booktabs}
\usepackage{mhchem}

\begin{document}

\begin{center}
\tablecaption{Caption for a long table}

\tablehead{%
    \hline 
    \textbf{Type} & \textbf{Quantity} & \textbf{Name\slash Model\slash Brand}\\
    \hline}
\tabletail{\hline}

\xentrystretch{0.03}
\setlength\extrarowheight{1pt} % for a more open "look"

\begin{xtabular}{|c|C{0.30\linewidth}|C{0.38\linewidth}|} 
S/T &  Temperature and Humidity & Phidgets Humidity and Temperature Sensor  \\
\hline
S/T & Temperature & D600 \\
\hline
S/T & Temperature and Humidity & AM2315 \\
\hline
S/T & Temperature and Humidity & SHT11 \\
\hline
S/T & Temperature and Humidity & AM2321 \\
\hline
S/T & Temperature and Humidity & Testo 175H1 \\
\hline
S/T & Temperature & Type-K Stainless Steel Thermocouple \\
\hline
A & Temperature & Thermostatic PTC heating element \\
\hline
A & Temperature & KippKitts cooling unit \\
\hline
A & Temperature, air flow, and humidity & Sunon KD1208PTS1 \\
\hline
A & Soil moisture & Control servo ES08AII \\
\hline
A & Soil moisture & Homecube peristaltic liquid pumps \\
\hline
S/T & Water level and soil moisture & VG400-LV \\
\hline
S/T & Water level & LLE102000 \\
\hline
A & Air humidity & Phtronics portable bottle cap air humidifier with bottle \\
\hline
A & Luminosity & GE light modules \\
\hline
A & Luminosity & Full spectrum Compact Fluorescent Light grow light \\
\hline
A & pH & General Hydroponics liquid bottles and FloraDuo fertilizers \\
\hline
S/T & Air humidity & HIH-4010 \\
\hline
S/T & Luminosity & Phidgets Light Sensor 70000 lux \\
\hline
S/T & Luminosity & ADPS-9002 \\
\hline
S/T & Luminosity & Adafruit TSL2561 \\
\hline
S/T & Luminosity & NJL7502L \\
\hline
S/T & pH & Atlas pH sensor \\ 
\hline
S/T & pH & Phidgets pH/ORP Adapter \\
\hline
S/T & Soil moisture & FC-28 \\
\hline
S/T & Soil moisture & ECH2O EC-5 \\
\hline
S/T & Air flow & Testo 435-4 hot wire anemometer + 0635 1535 thermal velocity probe  \\
\hline
S/T & Pressure & NPP-301 \\
\hline
S/T & Electric conductivity & Atlas EC \\
\hline
S/T & Water level & DS18B29\\
\hline
S/T & Image & ELP 5 Megapixel USB camera\\
\hline
S/T & Irradiation & International Light Technologies  Spectroradiometer ILT950~I \\
\hline
S/T & \ce{CO2} concentration & MHZ16\\
\hline
A & Soil moisture & Water pump (generic)\\
\hline
A & Temperature, air flow, and humidity & Fan (generic)\\
\hline
A & Temperature and luminosity & Light bulb (generic)\\
\hline
A & Humidity & Humidifier (generic)\\
\hline
A & Luminosity and air flow & DC motor (generic) \\
\hline
A & Luminosity & UV LED lamp (generic)\\
\hline
A & Air flow & DC blower (generic)\\
\hline
A & Oxygenation & Air pump (generic)\\
\hline
\end{xtabular} 
\end{center}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .