我想将文本垂直对齐第 1、3、4、5 和 6 列的中间。我已经尝试使用m{2cm}
,但它不起作用。
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{array,ragged2e}
\usepackage{multirow}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\begin{document}
\begin{table*}[!ht]
\centering
\caption{A survey of an energy optimized smart systems. }
\begin{adjustbox}{width=\textwidth}
\begin{tabular}{|c|P {2.5 cm}|P {2 cm}|c|c|c|}
\hline
Ref. & \centering{Components} & With Feedback & Individual Energy Consumption Monitoring & Cloud Platform & Cost Effective \\
\hline
\cite{Liao2019} & Arduino, PIR sensor, temperature and humidity sensor, particulate matter sensor, gas sensors, LUX sensor, Wi-Fi module & Yes & The energy consumption is not calculated. & ThingSpeak web service & Used low-cost devices\\
\hline
\cite{Chooruang2018} & Raspberry Pi, Router, Energy meter, CT (current transformer) sensor, energy measurement chip and ESP8266 & No & Able to calculate & InfluxDB & Used low-cost devices \\
\hline
\cite{Esquiagola2018} & Raspberry pi, border router, IAQ sensor node, wireless module
, Sensors: Temperature, Humidity, Pressure, Particulate Material, TVOC and eCO2. & No & No & MariaDB & Used low-cost devices\\
\hline
\cite{Jaribion2019} & Sensors: Particulate matter (PM), Air quality, Temperature and Humidity. & Yes & Yes & Local storage & Used low-cost devices\\
\hline
\cite{Avancini} & IoT Enabled Smart Energy Meter & No & Yes & Horus NMS & Quite expensive\\
\hline
\cite{Ramani2019} & Arduino, ESP8266, Voltage divider, battery, solar panel, optocoupler, inverter, relay, LCD, Energy meter,LDR sensor & Yes & Yes, overall not individually & Not mentioned & Not mentioned\\
\hline
\cite{D2017} & GSM Module, LCD, ZigBee Module,PIC micro-controller, Energy Meter & No & Yes, overall not individually & Not mentioned & Used low-cost devices\\
\hline
\cite{Dutta2017} & Arduino, Relay, Wi-Fi module, Bluetooth module, Cisco router, RFID reader, Laser, LDR, temperature and humidity sensor, PIR sensor, ultrasonic sensor, gas sensors, air pollution sensor, Flame Sensor & Yes & It is calculated for the whole system instead individually & Via fog cloud & Used low-cost devices \\
\hline
\cite{Gunawan2017} & Arduino, relay, ethernet shield, wireless module, gas sensor, temparture sensor, PIR sensor, ultrasonic sensor & No & The energy consumption is not calculated. & Through web app & In the mid-range.\\
\hline
\cite{Vivekbabu2017} & Raspberry Pi, analog temperature sensor, analog soil moisture sensor, rain sensor, LDR, temperature and humidty sensor, analog to digital converter, Wi-Fi module, LCD display, router & No & No calculation & sparkfun DB & Low-cost devices\\
\hline
\cite{Yuliansyah2019} & ESP8266, LDR, sonar sensor, light intensity sensor, relay, servo motor & Yes & Not calculated & & Mid-cost devices\\
% \hline
%\cite{Shrivastava2020} & & & & &\\
% \hline
% \cite{Kim2013} & & & & &\\
%\hline
%\cite{Zhang2014} & & & & &\\
\hline
\cite{Patchava2015} & Raspberry Pi, GSM Module, Sensors & User controlled & No calculation & MYSQLDB & Quite high-cost devices\\
\hline
\end{tabular}
\end{adjustbox}
\label{tab:my_label}
\end{table*}
\end{document}
答案1
我建议您放弃adjustbox
包装器,从环境切换tabular
到tabularx
环境,允许在第 2 列和第 4 列中进行文本换行/换行,通过摆脱所有垂直规则和大多数水平规则使表格看起来更加开放,最后但同样重要的是,运行\renewcommand\tabularxcolumn[1]{m{#1}}
以从顶部对齐切换到单元格内容的垂直居中。
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularx,booktabs,ragged2e}
\newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize}X} % variable-width, left-aligned
\renewcommand\tabularxcolumn[1]{m{#1}} % vertical centering
\begin{document}
\begin{table*}
\caption{Survey of energy optimized smart systems}
\label{tab:my_label}
\begin{tabularx}{\textwidth}{@{} l L{1.25} c L{0.75} l l @{}}
\toprule
Ref. & Components & With Feedback & Individual Energy Consumption Monitoring & Cloud Platform & Cost Effective \\
\midrule
\cite{Liao2019} & Arduino, PIR sensor, temperature and humidity sensor, particulate matter sensor, gas sensors, LUX sensor, Wi-Fi module & Yes & The energy consumption is not calculated. & ThingSpeak web service & Used low-cost devices\\
\addlinespace
\cite{Chooruang2018} & Raspberry Pi, Router, Energy meter, CT (current transformer) sensor, energy measurement chip and ESP8266 & No & Able to calculate & InfluxDB & Used low-cost devices \\
\addlinespace
\cite{Esquiagola2018} & Raspberry pi, border router, IAQ sensor node, wireless module. Sensors: Temperature, Humidity, Pressure, Particulate Material, TVOC and eCO2. & No & No & MariaDB & Used low-cost devices\\
\addlinespace
\cite{Jaribion2019} & Sensors: Particulate matter (PM), Air quality, Temperature and Humidity. & Yes & Yes & Local storage & Used low-cost devices\\
\addlinespace
\cite{Avancini} & IoT Enabled Smart Energy Meter & No & Yes & Horus NMS & Quite expensive\\
\addlinespace
\cite{Ramani2019} & Arduino, ESP8266, Voltage divider, battery, solar panel, optocoupler, inverter, relay, LCD, Energy meter,LDR sensor & Yes & Yes, overall not individually & Not mentioned & Not mentioned\\
\addlinespace
\cite{D2017} & GSM Module, LCD, ZigBee Module,PIC micro-controller, Energy Meter & No & Yes, overall not individually & Not mentioned & Used low-cost devices\\
\addlinespace
\cite{Dutta2017} & Arduino, Relay, Wi-Fi module, Bluetooth module, Cisco router, RFID reader, Laser, LDR, temperature and humidity sensor, PIR sensor, ultrasonic sensor, gas sensors, air pollution sensor, Flame Sensor & Yes & It is calculated for the whole system instead individually & Via fog cloud & Used low-cost devices \\
\addlinespace
\cite{Gunawan2017} & Arduino, relay, ethernet shield, wireless module, gas sensor, temparture sensor, PIR sensor, ultrasonic sensor & No & The energy consumption is not calculated. & Through web app & In the mid-range.\\
\addlinespace
\cite{Vivekbabu2017} & Raspberry Pi, analog temperature sensor, analog soil moisture sensor, rain sensor, LDR, temperature and humidty sensor, analog to digital converter, Wi-Fi module, LCD display, router & No & No calculation & sparkfun DB & Low-cost devices\\
\addlinespace
\cite{Yuliansyah2019} & ESP8266, LDR, sonar sensor, light intensity sensor, relay, servo motor & Yes & Not calculated & & Mid-cost devices\\
% \hline
%\cite{Shrivastava2020} & & & & &\\
% \hline
% \cite{Kim2013} & & & & &\\
%\hline
%\cite{Zhang2014} & & & & &\\
\addlinespace
\cite{Patchava2015} & Raspberry Pi, GSM Module, Sensors & User controlled & No calculation & MYSQLDB & Quite high-cost devices\\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
答案2
仅将使用tabularx
包的精彩 @Mico 答案 (+1) 转录到使用包的表中tabularray
。对于列规范,使用X[..,m]
(类似于X
列,但增加了单元格内容的大小和对齐规范)和Q[...]
(相当于c
,l
或˙r columns with added aligning specification):. Used
\addlinespace are replaced by specification of rows separation (
rowsep=3pt m default is
rowsep=2pt`。
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularray}
\begin{document}
\begin{table*}
\caption{Survey of energy optimized smart systems}
\label{tab:my_label}
\begin{tblr}{hline{1,2,Z} = 1pt,
colsep=4pt,
colspec = {@{} Q[l,m] X[2,l,j,m] Q[c,m] X[l,m] *{2}{Q[l,m]} @{}},
rowsep = 3pt}
Ref. & Components
& {With\\ Feedback} & Individual Energy Consumption Monitoring & Cloud Platform & Cost Effective \\
\cite{Liao2019}
& Arduino, PIR sensor, temperature and humidity sensor, particulate matter sensor, gas and LUX sensor, Wi-Fi module
& Yes & The energy consumption is not calculated. & ThingSpeak web service & Used low-cost devices\\
\cite{Chooruang2018}
& Raspberry Pi, Router, Energy meter, CT (current transformer) sensor, energy measurement chip and ESP8266
& No & Able to calculate & InfluxDB & Used low-cost devices \\
\cite{Esquiagola2018}
& Raspberry pi, border router, IAQ sensor node, wireless module. Sensors: Temperature, Humidity, Pressure, Particulate Material, TVOC and eCO2.
& No & No & MariaDB & Used low-cost devices\\
\cite{Jaribion2019}
& Sensors: Particulate matter (PM), Air quality, Temperature and Humidity.
& Yes & Yes & Local storage & Used low-cost devices\\
\cite{Avancini}
& IoT Enabled Smart Energy Meter
& No & Yes & Horus NMS & Quite expensive\\
\cite{Ramani2019}
& Arduino, ESP8266, Voltage divider, battery, solar panel, optocoupler, inverter, relay, LCD, Energy meter, LDR sensor
& Yes & Yes, overall not individually & Not mentioned & Not mentioned\\
\cite{D2017}
& GSM Module, LCD, ZigBee Module,PIC micro-controller, Energy Meter
& No & Yes, overall not individually & Not mentioned & Used low-cost devices\\
\cite{Dutta2017}
& Arduino, Relay, Wi-Fi module, Bluetooth module, Cisco router, RFID reader, Laser, LDR, temperature and humidity sensor, PIR sensor, ultrasonic sensor, gas sensors, air pollution sensor, Flame Sensor
& Yes & It is calculated for the whole system instead individually & Via fog cloud & Used low-cost devices \\
\cite{Gunawan2017}
& Arduino, relay, ethernet shield, wireless module, gas sensor, temparture sensor, PIR sensor, ultrasonic sensor
& No & The energy consumption is not calculated. & Through web app & In the mid-range.\\
\cite{Vivekbabu2017}
& Raspberry Pi, analog temperature sensor, analog soil moisture sensor, rain sensor, LDR, temperature and humidity sensor, analog to digital converter, Wi-Fi module, LCD display, router
& No & No calculation & sparkfun DB & Low-cost devices\\
\cite{Yuliansyah2019}
& ESP8266, LDR, sonar sensor, light intensity sensor, relay, servo motor
& Yes & Not calculated & & Mid-cost devices\\
% \hline
%\cite{Shrivastava2020} & & & & &\\
% \hline
% \cite{Kim2013} & & & & &\\
%\hline
%\cite{Zhang2014} & & & & &\\
\cite{Patchava2015}
& Raspberry Pi, GSM Module, Sensors
& {User\\ controlled} & No calculation & MYSQLDB & Quite high-cost devices\\
\end{tblr}
\end{table*}
\end{document}
答案3
您可以使用这个tabularray
包,它使得处理行和列变得非常容易。
%To make the code compilable with bibliography file without any warning
%Should be omitted in the original document
%---------------------------------------------
\begin{filecontents}{\jobname.bib}
@book{key,
author = {Author, A.},
year = {2001},
title = {Title},
publisher = {Publisher},
}
\end{filecontents}
%---------------------------------------------
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularray}
\begin{document}
\begin{table*}[htbp]
\centering
\caption{A survey of an energy optimized smart systems. }
\label{tab:my_label}
\begin{tblr}{
hlines, vlines,
width = \textwidth,
colspec = {X[0.25,c,m] X[1.5,l,m] X[0.5,c,m] X[1.25,l,m] X[c,m] X[c,m]},
}
Ref. & \centering{Components} & With Feedback & Individual Energy Consumption Monitoring & Cloud Platform & Cost Effective \\
\cite{key} & Arduino, PIR sensor, temperature and humidity sensor, particulate matter sensor, gas sensors, LUX sensor, Wi-Fi module & Yes & The energy consumption is not calculated. & ThingSpeak web service & Used low-cost devices\\
\cite{key} & Raspberry Pi, Router, Energy meter, CT (current transformer) sensor, energy measurement chip and ESP8266 & No & Able to calculate & InfluxDB & Used low-cost devices \\
\cite{key} & Raspberry pi, border router, IAQ sensor node, wireless module
, Sensors: Temperature, Humidity, Pressure, Particulate Material, TVOC and eCO2. & No & No & MariaDB & Used low-cost devices\\
\cite{key} & Sensors: Particulate matter (PM), Air quality, Temperature and Humidity. & Yes & Yes & Local storage & Used low-cost devices\\
\cite{key} & IoT Enabled Smart Energy Meter & No & Yes & Horus NMS & Quite expensive\\
\cite{key} & Arduino, ESP8266, Voltage divider, battery, solar panel, optocoupler, inverter, relay, LCD, Energy meter,LDR sensor & Yes & Yes, overall not individually & Not mentioned & Not mentioned\\
\cite{key} & GSM Module, LCD, ZigBee Module,PIC micro-controller, Energy Meter & No & Yes, overall not individually & Not mentioned & Used low-cost devices\\
\cite{key} & Arduino, Relay, Wi-Fi module, Bluetooth module, Cisco router, RFID reader, Laser, LDR, temperature and humidity sensor, PIR sensor, ultrasonic sensor, gas sensors, air pollution sensor, Flame Sensor & Yes & It is calculated for the whole system instead individually & Via fog cloud & Used low-cost devices \\
\cite{key} & Arduino, relay, ethernet shield, wireless module, gas sensor, temparture sensor, PIR sensor, ultrasonic sensor & No & The energy consumption is not calculated. & Through web app & In the mid-range.\\
\cite{key} & Raspberry Pi, analog temperature sensor, analog soil moisture sensor, rain sensor, LDR, temperature and humidty sensor, analog to digital converter, Wi-Fi module, LCD display, router & No & No calculation & sparkfun DB & Low-cost devices\\
\cite{key} & ESP8266, LDR, sonar sensor, light intensity sensor, relay, servo motor & Yes & Not calculated & & Mid-cost devices\\
%
%\cite{Shrivastava2020} & & & & &\\
%
% \cite{Kim2013} & & & & &\\
%
%\cite{Zhang2014} & & & & &\\
\cite{key} & Raspberry Pi, GSM Module, Sensors & User controlled & No calculation & MYSQLDB & Quite high-cost devices\\
\end{tblr}
\end{table*}
\bibliographystyle{IEEEtran} %usual style used by IEEE articles
\bibliography{\jobname}
\end{document}
该选项hlines
用于在每行周围插入水平线,以及vlines
在每列周围插入垂直线。width
指定整个表格的宽度,colspec
用于指定列类型。