3

I am trying to create a table using tabular environment. However I am getting two errors. The first error is the one where there is an illegal pream-token (s): `c' used. The second problem is that I don't get any output under the units columns. Kinldy refer to where I used the SI units in my MWE for the specification of location units and area units.

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

I appreciate any input to help me solve this problem. What I am getting is shown on the screenshot below. enter image description here

6
  • 1
    Welcome to TeX.SE. You need to either provide a definition of the s column type or load a package that provides such a definition. (The siunitx package may, or may not, be a candidate.)
    – Mico
    May 3, 2019 at 12:07
  • Be careful about the combination of caption package and IEEEtran, this is not supported
    – user188004
    May 3, 2019 at 12:09
  • The instruction \cmidrule(c){1-3} is bound to throw an error message as well. Not sure what you're trying to achieve, but \cmidrule(lr){1-3} may be the way to go.
    – Mico
    May 3, 2019 at 12:10
  • 1
    So to sum up: add \usepackage{siunitx} after the other usepackage statements, change \cmidrule(c) to \cmidrule(lr), and add math switches at appropriate places in the last two lines of the table.
    – Marijn
    May 3, 2019 at 12:16
  • 1
    Thank you all very much for your help. I had actually made a mistake deleting some of the items on my preamble for the MWE and I deleted the 'siunitx' package when I posted my question.
    – Supremum
    May 3, 2019 at 14:28

2 Answers 2

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}

enter image description here

1

I would like to recommend that you re-organize your table so that it fits within a single column.

enter image description here

\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}
1
  • 1
    Thank you. I have a very long table hence I created it spanning two columns, I cut it short just for the MWE. Thank you very much for your help.
    – Supremum
    May 3, 2019 at 14:30

You must log in to answer this question.

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