1

I have been trying to get a line under the first cell of the second row but instead the command is working on the first row. While it is working on the others.

enter image description here

my code:

\documentclass[conference]{IEEEtran}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{tabularx,booktabs,ragged2e,bm,newtxmath} % new packages
\usepackage{pgfplots}\pgfplotsset{compat=1.16}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{xcolor}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\begin{document}

\begin{table*}
\setlength\tabcolsep{3pt}
\caption{System variables dependencies}\label{tab2}
\begin{tabularx}{\linewidth}{@{} X *{5}{Y} @{}}
\toprule
System variables 
& $o_{v}$
& $s_{p}$
& $t_{m}$
& $l_{ft}$
& $l_{ot}$
\cmidrule(l){2-2} \cmidrule(l){3-3} \cmidrule(l){4-4} 
\cmidrule(l){5-5} \cmidrule(l){6-6}
\addlinespace
Subsystem associated & V & Pr & M & $\textrm{T}_\textrm{1}$ & 
$\textrm{T}_  \textrm{2}$ \\
\addlinespace
Mathematical dependencies & & & $t_{m}(t)=23-0.25
\times  o_{v}(t)+0.62\times s_{p}(t)$
& $l_{ft}(t)=l_{ft}(t-1) -0.001\times s_{p}(t)$
& $l_{ft}(t)=l_{ft}(t-1) -0.0005\times s_{p}(t)$ \\
\addlinespace
Operational dependencies & $o_{v}(t)=0$ if $s_{p}(t)=0$ & & 
& $l_{ft}(t)=l_{ft}(t-1)$ if $s_{p}(t)=0$
& $l_{ot}(t)=l_{ot}(t-1)$ if $s_{p}(t)=0$ \\
\addlinespace
Nominal value range 
& $0\rightarrow100$ (\%) 
& $0\rightarrow100$ (\%)
& $23\rightarrow83$ (°C)
& $2\rightarrow100$ (\%)
& $2\rightarrow100$ (\%)\\ 
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
  • 1
    This code throws a bunch of errors, so no wonder the result looks strange. You forgot the \\ after the first line. – campa Feb 26 at 12:50
  • 1
    Please do remove the two lines starting with \def\BibTeX. They're unnecessary and may break other things. None of the templates provided by recent versions of IEEEtran show them. – egreg Feb 26 at 13:00
5

Give \\ before \cmidrule

\documentclass{book}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{tabularx,booktabs,ragged2e,bm,newtxmath} % new packages
\usepackage{pgfplots}\pgfplotsset{compat=1.14}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{xcolor}
%%%% remove this line and the two below (here just commented)
%\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
%T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\begin{document}

\begin{table*}
\caption{System variables dependencies}\label{tab2}
\begin{tabularx}{\linewidth}{@{} X *{5}{Y} @{}}
\toprule
System variables & $o_{v}$ & $s_{p}$ & $t_{m}$ & $l_{ft}$ & $l_{ot}$\\
\cmidrule(l){2-2} \cmidrule(l){3-3} \cmidrule(l){4-4} 
\cmidrule(l){5-5} \cmidrule(l){6-6}
\addlinespace
Subsystem associated & V & Pr & M & $\textrm{T}_\textrm{1}$ & 
$\textrm{T}_  \textrm{2}$ \\
\addlinespace
Mathematical dependencies & & & $t_{m}(t)=23-0.25
\times  o_{v}(t)+0.62\times s_{p}(t)$
& $l_{ft}(t)=l_{ft}(t-1) -0.001\times s_{p}(t)$
& $l_{ft}(t)=l_{ft}(t-1) -0.0005\times s_{p}(t)$ \\
\addlinespace
Operational dependencies & $o_{v}(t)=0$ if $s_{p}(t)=0$ & & 
& $l_{ft}(t)=l_{ft}(t-1)$ if $s_{p}(t)=0$
& $l_{ot}(t)=l_{ot}(t-1)$ if $s_{p}(t)=0$ \\
\addlinespace
Nominal value range 
& $0\rightarrow100$ (\%) 
& $0\rightarrow100$ (\%)
& $23\rightarrow83$ (°C)
& $2\rightarrow100$ (\%)
& $2\rightarrow100$ (\%)\\ 
\bottomrule
\end{tabularx}
\end{table*}
\end{document}

PS: I didn't check your code except the error

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.