如何将长表格分成两列以容纳两列文本?

如何将长表格分成两列以容纳两列文本?

我正在写一篇文章,模板是两列文本。我有这张表:

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

当我编译该文档时,我得到了以下结果:

表格的第一部分位于页面的第一列,表格的第二部分位于下一页的第二列。如何让这些部分并排显示在同一页上?

答案1

longtable在双列文档中无法正确使用该环境。请改用包xtabular提供的环境xtab

哦,我已经删除了所有\thead包装,因为似乎都不需要它们。

在此处输入图片描述

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

相关内容