我正在尝试使用表格环境创建一个表。但是我遇到了两个错误。第一个错误是使用了非法的前缀标记:`c'。第二个问题是我在单位列下没有得到任何输出。请参考我在 MWE 中使用 SI 单位来指定位置单位和面积单位的地方。
\documentclass[journal,twoside]{IEEEtran}
\usepackage[a4paper,left=1.5cm, right=1.5cm, bottom=1.5cm,top=1.5cm]{geometry}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\begin{document}
\begin{table*}[!ht]
\caption{NLOS Simulation parameters}
\label{tab:NLOSSim}
\centering
\smallskip
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}l l s l l s}
\hline
\hline
\multicolumn{3}{c}{Transmitter} & \multicolumn{3}{c}{Receiver}\\
\cmidrule(c){1-3}\cmidrule(c){4-6}
Parameter & Value & \mc{Units} & Parameter & Value & \mc{Units}\\
\midrule
Room size & $5\times 5\times 3$ & \cubic\metre & Location\left(x,y,z\right) & \left(1.5, 1.5, 0\right) & \\
\rho_{n}=\rho_{s}=\rho_{e}=\rho_{w} & 0.8 & & Active area \left(A_{r} \right) & 1 & \centi\metre\\
\hline
\hline
\end{tabular*}
\end{table*}
\end{document}
答案1
\documentclass[journal,twoside]{IEEEtran}
\usepackage[a4paper,left=1.5cm, right=1.5cm, bottom=1.5cm,top=1.5cm]{geometry}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\begin{document}
\begin{table*}[!ht]
\caption{NLOS Simulation parameters}\label{tab:NLOSSim}
\smallskip \def\arraystretch{1.4}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}l l s l l s}\hline\hline
\multicolumn{3}{@{}c}{Transmitter} & \multicolumn{3}{c@{}}{Receiver}\\\cmidrule{1-3}\cmidrule{4-6}
Parameter & Value & \mc{Units} & Parameter & Value & \mc{Units}\\\midrule
Room size & $5\times 5\times 3$ & \cubic\metre & Location $\left(x,y,z\right)$ & $\left(1.5, 1.5,
0\right)$ & \\
$\rho_{n}=\rho_{s}=\rho_{e}=\rho_{w}$ & 0.8 & & Active area $\left(A_{r} \right)$ & 1 &
\centi\metre\\\hline\hline
\end{tabular*}
\end{table*}
\end{document}
答案2
我建议您重新组织您的表格,以便它适合单列。
\documentclass[journal,twoside]{IEEEtran}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage{amsmath,amsthm,amssymb,graphicx}
\usepackage{newtxtext,newtxmath} % optional
\usepackage[utf8]{inputenc}
\usepackage{tabularx,booktabs}
\usepackage{siunitx} % for 's' column type
\usepackage{lipsum} % filler text
\begin{document}
\begin{table}[ht!]
\caption{NLOS Simulation parameters}
\label{tab:NLOSSim}
\centering
\begin{tabular}{@{} lls @{}}
\toprule
Parameter & Value & {Units} \\
\midrule
Transmitter\\
Room size & $5\times 5\times 3$ & \cubic\metre \\
$\rho_{n}=\rho_{s}=\rho_{e}=\rho_{w}$ & $0.8$ \\
\addlinespace
Receiver\\
Location $(x,y,z)$ & $(1.5, 1.5, 0)$ \\
Active area $(A_{r})$ & $1$ & \centi\metre\\
\bottomrule
\end{tabular}
\end{table}
\lipsum{1-5} % filler text
\end{document}