0

I would like to create a table in a two columns template, but the table can occupy 1 column as follows.

enter image description here

I am not sure what to do with this code, can anyone help, please?

\documentclass[journal]{IEEEtran}
\usepackage{tabularray}
\begin{document}
\begin{table}[h]
  \caption{Test Table}
  \label{tab:table_x}
  \centering
  \begin{tblr}{%
      colspec = {QQQ},
      hlines, vlines,
      columns={c}, rows={m},
      row{1}={font=\bfseries},
    }
    Wafer Flow Pattern & Parameters & 
    Percentage of Instances Solved by MIP & 
    Average Gap from Optimal Solution \\
    Percentage of Instances Solved by MIP & Parameters & 
    Swap & Backward & New Sequence \\
    [1,1,1] & $p_i \in [0-300], \forall i \in \{1,2,3\}$ $c_i \in [0-300], \forall i \in \{1,2,3\}$ random sampling size = 200 & xx\% & xx\% & xx\% \\
    [1,2,1] &  & xx\% & xx\% & xx\% \\
    [1,2,2] &  & xx\% & xx\% & xx\% \\
    [1,3,1] &  & xx\% & xx\% & xx\% \\
    [1,1,1,1] & $p_i \in [0-300], \forall i \in \{1,2,3,4\}$ $c_i \in [0-300], \forall i \in \{1,2,3,4\}$ random sampling size = 200 & xx\% & xx\% & xx\% \\
    [1,2,1,1] &  & xx\% & xx\% & xx\% \\
    [1,3,1,1] &  & xx\% & xx\% & xx\% \\
    [1,2,1,2] &  & xx\% & xx\% & xx\% \\
    [1,3,1,1] &  & xx\% & xx\% & xx\% \\
    [1,2,1,2] &  & xx\% & xx\% & xx\% \\
    [1,2,2,1] &  & xx\% & xx\% & xx\% \\
    [1,2,2,2] &  & xx\% & xx\% & xx\% \\
    [1,3,2,1] &  & xx\% & xx\% & xx\% \\
    [1,1,1,1,1] & $p_i \in [0-300], \forall i \in \{1,2,3,4,5\}$ $c_i \in [0-300], \forall i \in \{1,2,3,4,5\}$ random sampling size = 200  & xx\% & xx\% & xx\% \\
    [1,2,1,1,1] &  & xx\% & xx\% & xx\% \\
    Average & - & xx\% & xx\% & xx\% \\
    \end{tblr}  
\end{table}

\end{document}

Thank you.

1 Answer 1

1
  1. to have the table on a column cf documentation https://mirror.ufs.ac.za/ctan/macros/latex/contrib/IEEEtran/IEEEtran_HOWTO.pdf section D. Double Column Floats p.11
  2. to put text on two lines we can use \SetCell[r=2]{c} and on three columns \SetCell[c=3]{c}
  3. to go to the line in a cell we can use {$p_i \in [0-300], \forall i \in \{1,2,3,4\}$ $c_i \in [0-300], \forall i \in \{1,2,3,4\}$\\\rs}
  4. I added a \rs command for random sampling size=200
  5. to have the last row in \bfseries row{1,Z}={font=\bfseries},

The code

    \documentclass[journal]{IEEEtran}
    \usepackage{showframe}
    \usepackage{lipsum}
    \usepackage{tabularray}
    \newcommand{\rs}{random sampling size = 200}
    \begin{document}
    \lipsum[1-8]
    \begin{table*}[!t]
    \centering
    \caption{Test Table}

    \begin{tblr}{
        colspec = {X[1]X[3]X[1]X[1]X[1]X[1]}, 
        hlines, vlines, 
        columns={c},
        rows={m},
        row{1,Z}={font=\bfseries},
        }  
    \SetCell[r=2]{c}Wafer Flow Pattern   & \SetCell[r=2]{c}Parameters   & \SetCell[r=2]{c}Percentage of Instances Solved by MIP & \SetCell[c=3]{c}Average Gap from Optimal Solution \\

    &&&Swap & Backward & New Sequence \\

    [1,1,1] & \SetCell[r=4]{c}{$p_i \in [0-300], \forall i \in \{1,2,3\}$ $c_i \in [0-300], \forall i \in \{1,2,3\}$ \\\rs}& xx\% & xx\% & xx\% \\

    [1,2,1] &  & xx\% & xx\% & xx\% \\

    [1,2,2] &  & xx\% & xx\% & xx\% \\

    [1,3,1] &  & xx\% & xx\% & xx\% \\

    [1,1,1,1] & \SetCell[r=7]{c}{$p_i \in [0-300], \forall i \in \{1,2,3,4\}$ $c_i \in [0-300], \forall i \in \{1,2,3,4\}$\\\rs} & xx\% & xx\% & xx\% \\

    [1,2,1,1] &  & xx\% & xx\% & xx\% \\

    [1,3,1,1] &  & xx\% & xx\% & xx\% \\

    [1,2,1,2] &  & xx\% & xx\% & xx\% \\

    [1,3,1,1] &  & xx\% & xx\% & xx\% \\

    [1,2,1,2] &  & xx\% & xx\% & xx\% \\

    [1,2,2,1] &  & xx\% & xx\% & xx\% \\

    [1,2,2,2] &  & xx\% & xx\% & xx\% \\

    [1,3,2,1] &  & xx\% & xx\% & xx\% \\

    [1,1,1,1,1] & \SetCell[r=2]{c}{$p_i \in [0-300], \forall i \in \{1,2,3,4,5\}$ $c_i \in [0-300], \forall i \in \{1,2,3,4,5\}$\\\rs}  & xx\% & xx\% & xx\% \\

    [1,2,1,1,1] &  & xx\% & xx\% & xx\% \\

    Average & - & xx\% & xx\% & xx\% \\
    \end{tblr}
    \label{tab:table_x}
    \end{table*}

    \end{document}

enter image description here

3
  • I edited the answer
    – pascal974
    Mar 21, 2023 at 11:42
  • Hi @pascal974, thank you for the answer! By the way, if I would like to make the column more fit with the content, what code should I add? For example, the white space on the left and right side in the column Parameter remains a lot.. thank you. Mar 21, 2023 at 11:48
  • you can test colspec = {X[1]X[2]X[1]X[1]X[1]X[1]} or colspec = {Q[wd=2cm]X[2]X[1]*{3}{Q[wd=2.5cm]}}... look at section 2.6.1 Colspec and Width of the tabullaray documentation
    – pascal974
    Mar 21, 2023 at 12:28

You must log in to answer this question.

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