2

I have this code for table. I want to put this table in one column in ieee format.

the code is given

  \documentclass{IEEEtran}
    
    \usepackage[margin=1in]{geometry}
    \usepackage{booktabs}
    \usepackage{makecell}% <--- added
    
    \begin{document}
    \begin{table*}
    \centering
    \caption{Solution with \texttt{tabular}}
    \begin{tabular}{@{} ll *{6}{c} @{}}
    \toprule
    Heading 1 & State of Health 
      &\multicolumn{3}{c}{Fasting Value} 
      &\multicolumn{3}{c}{After Eating}\\
    \cmidrule(lr){3-5} \cmidrule(l){6-8}
     & & \makecell{Maxxxxxxx\\xxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxx} & Maxxxxxxxxxxxx & lllllllllllllllllLow & 2hrs & 3hrs & 4hrs\\
    \midrule
    add & Healthy  &70 &100 &a  &$< 140$ & &\\
    \addlinespace %\midrule
    del & Pre-Diabetes &101  &126  &a & 140--200 & &\\
    \addlinespace %\midrule
    mult & Diabetes &$>126$ &N/A  &a & $>200$ & &\\
    \bottomrule
    \end{tabular}
    \end{table*}
    
    \end{document}
3
  • What do you mean exactly? That the table should typed over the whole textwidth?
    – Bernard
    Aug 17, 2021 at 20:09
  • this table cover whole page and i am using ieee format 2 column. i want to move table or fit table to one column
    – user12
    Aug 17, 2021 at 20:11
  • 2
    With 8 columns, it doesn't seem possible while keeping the table readable.
    – Bernard
    Aug 17, 2021 at 20:16

2 Answers 2

4

enter image description here

\documentclass{IEEEtran}
\usepackage{tabularx,ragged2e,booktabs}
\usepackage{kantlipsum}% dummy text

\newcolumntype{C}{>{\Centering\arraybackslash}X} % 
\frenchspacing
\begin{document}
1.  \kant[1]

\begin{table}[h]

\setlength{\tabcolsep}{2pt} % a bit more whitespace
\begin{tabularx}{\columnwidth}{@{} ll *{6}{C} @{}}
    \toprule
     Heading 1 
        & State of Health 
            &\multicolumn{3}{c}{Fasting Value} 
                &\multicolumn{3}{c}{After Eating}\\
    \cmidrule(lr){3-5} \cmidrule(l){6-8}
        & 
            & A 
                & B 
                    & C 
                        & 2hrs 
                            & 3hrs 
                                & 4hrs\\
    \midrule
        add 
            & Healthy  
                &70 
                    &100 
                        &a  
                            &$< 140$ 
                                & &\\
    \addlinespace %\midrule
        del 
            & Pre-Diabetes 
                &101  
                    &126  
                        &a 
                            & 140--200 
                                & &\\
    \addlinespace %\midrule
        mult 
            & Diabetes 
                &$>126$ 
                    &N/A  
                        &a 
                            & $>200$ 
                                & &\\
    \bottomrule
\end{tabularx}

\smallskip
A is Maxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 

B is Maxxxxxxxxxxxx

C is lllllllllllllllllLow

\caption{Precision results of diabetes for various feature subsets.}
\label{table:new}
\end{table}

3.  \kant[9-10]

4.  \kant[9]
    
\end{document} 
1
  • 1
    +1 for suggesting to simplify/abbreviate the header cell contents and to provide a separate legend in which the abbreviations are spelled out.
    – Mico
    Aug 18, 2021 at 5:12
3

As recommended by IEEEtran, you can use the stfloats package to send the table to the top or bottom of a double column page.

TOP

t

BOTTOM

b

% !TeX TS-program = pdflatex
\documentclass{IEEEtran}

\usepackage[margin=1in]{geometry}
\usepackage{booktabs}
\usepackage{makecell}% <--- added

\usepackage{kantlipsum}% dummy text

\usepackage{stfloats}% added <<<<<<<<<<<<<<<

\begin{document}
1.  \kant[1]
    
2.  \kant[11]
    
    \begin{table*}[b] % bottom
        \centering
        \caption{Solution with \texttt{tabular}}
        \begin{tabular}{@{} ll *{6}{c} @{}}
            \toprule
            Heading 1 & State of Health 
            &\multicolumn{3}{c}{Fasting Value} 
            &\multicolumn{3}{c}{After Eating}\\
            \cmidrule(lr){3-5} \cmidrule(l){6-8}
            & & \makecell{Maxxxxxxx\\xxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxx} & Maxxxxxxxxxxxx & lllllllllllllllllLow & 2hrs & 3hrs & 4hrs\\
            \midrule
            add & Healthy  &70 &100 &a  &$< 140$ & &\\
            \addlinespace %\midrule
            del & Pre-Diabetes &101  &126  &a & 140--200 & &\\
            \addlinespace %\midrule
            mult & Diabetes &$>126$ &N/A  &a & $>200$ & &\\
            \bottomrule
        \end{tabular}
    \end{table*}
3.  \kant[9-10]

4.  \kant[9]
    
5.  \kant[12]   
\end{document}

You must log in to answer this question.

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