2

I have this table:

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularx,booktabs,newtxmath} 
\newcolumntype{Z}{>{\centering\arraybackslash}X}

\begin{document}

\begin{table*}
\caption{Scenario descriptions}\label{tab3}
\begin{tabularx}{\linewidth}{>{\hsize=.3\hsize\linewidth=\hsize } Z *{9}{Z} @{}}
\toprule
& \multicolumn{3}{c@{}}{Anomaly triggering} & \multicolumn{3}{c@{}}{Anomaly description} \\
\cmidrule(l){2-4}\cmidrule(l){5-7}
\addlinespace
Scenario & Condition & Begin & End & Type & Target & Impacted security criteria \\
\midrule
\addlinespace
1  & 1 & 2 & 3 & 4 & blablablablabla blab lablabl ablablabla ablablabla & 6\\
\addlinespace
2 & 1 & 2 & 3 & 4 & 5 & 6\\
\addlinespace
3 & 1 & 2 & 3 & 4 & 5 & 6  \\
\addlinespace
4 & 1 & 2 & 3 & 4 & 5 & 6 \\
\bottomrule
\end{tabularx}
\end{table*}

\end{document}

I would like to adjust the "Target" column because there is long text in it. I know that X columns in a single table are set to the same width but I tried to force the first column width with >{\hsize=.3\hsize\linewidth=\hsize } Z but the other column widths don't adapt.

Other question: Do you think it's better to adjust "Scenario" with the \cmidrule(l) line ?

Thanks for your help.

Here is an image of the result: enter image description here

1
  • the Target column with raggedright format is shown in the answer below-- putting a line above Scenario does not really work well – js bibra Jan 19 at 9:24
2

I'd use tabular*

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularx,booktabs,newtxmath}

\begin{document}

\begin{table*}

\caption{Scenario descriptions}\label{tab3}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{7}{c} @{}}
\toprule
& \multicolumn{3}{c}{Anomaly triggering} & \multicolumn{3}{c@{}}{Anomaly description} \\
\cmidrule{2-4}\cmidrule{5-7}
\addlinespace
Scenario & Condition & Begin & End & Type & Target & Impacted security criteria \\
\midrule
\addlinespace
1  & 1 & 2 & 3 & 4 & \multicolumn{1}{p{3cm}}{\centering blablablablabla blab lablabl ablablabla ablablabla} & 6\\
\addlinespace
2 & 1 & 2 & 3 & 4 & 5 & 6\\
\addlinespace
3 & 1 & 2 & 3 & 4 & 5 & 6  \\
\addlinespace
4 & 1 & 2 & 3 & 4 & 5 & 6 \\
\bottomrule
\end{tabular*}

\end{table*}

\end{document}

enter image description here

1

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{tabularx,booktabs,newtxmath,lipsum} 
\newcolumntype{Z}{>{\centering\arraybackslash}X}

\begin{document}
    
    \begin{table*}
        \caption{Scenario descriptions}\label{tab3}
        \begin{tabularx}{\linewidth}{  *{5}{c}Zc}
            \toprule
            & \multicolumn{3}{c@{}}{Anomaly triggering} & \multicolumn{3}{c@{}}{Anomaly description} \\
            \cmidrule(l){2-4}\cmidrule(l){5-7}\cmidrule{1-1}
            \addlinespace
            Scenario & Condition & Begin & End & Type & Target & Impacted security criteria \\
            \midrule
            \addlinespace
            1  & 1 & 2 & 3 & 4 & \raggedright\lipsum[1] & 6\\
            \addlinespace
            2 & 1 & 2 & 3 & 4 & 5 & 6\\
            \addlinespace
            3 & 1 & 2 & 3 & 4 & 5 & 6  \\
            \addlinespace
            4 & 1 & 2 & 3 & 4 & 5 & 6 \\
            \bottomrule
        \end{tabularx}
    \end{table*}
    
\end{document}

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.